[llvm-branch-commits] [llvm] [DA] Check nsw when extracting a constant operand of SCEVMul (PR #164408)

Ryotaro Kasuga via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Oct 29 04:57:34 PDT 2025


================
@@ -2828,8 +2828,9 @@ static std::optional<APInt> getConstantPart(const SCEV *Expr) {
   if (const auto *Constant = dyn_cast<SCEVConstant>(Expr))
     return Constant->getAPInt();
   if (const auto *Product = dyn_cast<SCEVMulExpr>(Expr))
-    if (const auto *Constant = dyn_cast<SCEVConstant>(Product->getOperand(0)))
-      return Constant->getAPInt();
+    if (Product->hasNoSignedWrap())
----------------
kasuga-fj wrote:

Thanks, renamed

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


More information about the llvm-branch-commits mailing list