================
@@ -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())
----------------
Meinersbur wrote:

Could you update the function comment, maybe even the function name? This 
returns the (constant) coefficent/slope of a linear function. Without NSW, it 
is still a "constant part", just not the slope of a linear function. 
Suggestion: `getConstCoefficent`, like at those places where it is called.

https://github.com/llvm/llvm-project/pull/164408
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to