[llvm] [SCEV] Fold zext(C+A)<nsw> -> (sext(C) + zext(A))<nsw> if possible. (PR #142599)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 3 06:58:51 PDT 2025
================
@@ -1793,6 +1793,18 @@ const SCEV *ScalarEvolution::getZeroExtendExprImpl(const SCEV *Op, Type *Ty,
return getAddExpr(Ops, SCEV::FlagNUW, Depth + 1);
}
+ const SCEVConstant *C;
+ const SCEV *A;
+ // zext (C + A)<nsw> -> (sext(C) + zext(A))<nsw> if zext (C + A)<nsw> >=s 0
+ // and A >=s V.
----------------
nikic wrote:
```suggestion
// and A >=s C.
```
https://github.com/llvm/llvm-project/pull/142599
More information about the llvm-commits
mailing list