Teach Clang/LLVM that `rem_euclid` is always positive
Open
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
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