llvm / llvm/llvm-project

Teach Clang/LLVM that `rem_euclid` is always positive

Open
#224,449 0 comments 0 reactions 0 assignees View on GitHub
clang llvm:analysis
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

Godbolt: https://godbolt.org/z/3d15c66s4
Alive2: https://alive2.llvm.org/ce/z/gpzmSn

Clang/LLVM is able to deduce that `rem_euclid(x, positive_constant)` is always `>= 0`, but is not able to do the same for `rem_euclid(x, positive_y)`.

Contributor guide

Open the contributing guide

Research direction

Start with the Godbolt reproducer and compare it with the Alive2 proof to identify the missing deduction for a variable positive divisor. Trace where rem_euclid is represented and optimized in Clang/LLVM, then add or update a regression test showing that the result is proven non-negative for positive runtime values.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.