[llvm] [VPlan] Refine DerivedIV nowrap contract (PR #205908)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 26 02:35:56 PDT 2026


================
@@ -4008,11 +4008,17 @@ static void expandVPDerivedIV(VPDerivedIVRecipe *R) {
     assert(Index->getScalarType() == Start->getScalarType() &&
            "Index type does not match StartValue type");
     return R->replaceAllUsesWith(Builder.createAdd(
-        Start, Builder.createOverflowingOp(Instruction::Mul, {Index, Step})));
+        Start,
+        Builder.createOverflowingOp(Instruction::Mul, {Index, Step},
+                                    {/*HasNUW=*/true, /*HasNSW=*/false}),
----------------
Mel-Chen wrote:

Could the step be negative? If yes, `mul nuw` shouldn't be valid here?

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


More information about the llvm-commits mailing list