[llvm] [SCEV] Consider IVMayOverflow to use cheap BE-count formula. (PR #218694)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 26 06:54:55 PDT 2026
================
@@ -13589,7 +13590,10 @@ ScalarEvolution::howManyLessThans(const SCEV *LHS, const SCEV *RHS,
// "((End - 1) - (Start - Stride)) /u Stride" reduces to
// "((RHS - 1) - (Start - Stride)) /u Stride" reassociates to
// "((RHS - (Start - Stride) - 1) /u Stride".
- // Our preconditions trivially imply no overflow in that form.
+ // Our preconditions imply no overflow in that form: If !IVMayOverflow,
+ // we proven RHS + stride - 1 does not wrap. Otherwise, if "Start -
----------------
nikic wrote:
```suggestion
// we have proven RHS + Stride - 1 does not wrap. Otherwise, if "Start -
```
https://github.com/llvm/llvm-project/pull/218694
More information about the llvm-commits
mailing list