[llvm] [SCEV] Prove no-self-wrap from negative power of two step (PR #101416)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 1 12:17:44 PDT 2024


================
@@ -9158,7 +9158,8 @@ ScalarEvolution::ExitLimit ScalarEvolution::computeExitLimitFromICmp(
       InnerLHS = ZExt->getOperand();
     if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(InnerLHS);
         AR && !AR->hasNoSelfWrap() && AR->getLoop() == L && AR->isAffine() &&
-        isKnownToBeAPowerOfTwo(AR->getStepRecurrence(*this), /*OrZero=*/true)) {
+        isKnownToBeAPowerOfTwo(AR->getStepRecurrence(*this), /*OrZero=*/true,
+                               /*OrNegative*/ true)) {
----------------
nikic wrote:

```suggestion
                               /*OrNegative=*/true)) {
```
For consistency.

https://github.com/llvm/llvm-project/pull/101416


More information about the llvm-commits mailing list