[llvm] [LV] Add extra check for signed oveflow for SDiv/SRem (PR #170818)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 12 00:17:48 PST 2025


================
@@ -2893,16 +2893,16 @@ bool LoopVectorizationCostModel::isPredicatedInst(Instruction *I) const {
     bool MayBeNegOne = SE.getSignedRange(RHSSC).contains(MinusOne);
 
     // No predicate if RHS have no poison in masked-off lanes and not -1.
-    if (isa<SCEVAddRecExpr>(RHSSC) && !MayBeNegOne)
+    if (Legal->isInductionVariable(RHS) && !MayBeNegOne)
       return false;
----------------
lukel97 wrote:

Will we return false if the RHS is an IV that can be zero at some iteration? Is there a test that covers this

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


More information about the llvm-commits mailing list