[llvm] [VPlan] Make canonical IV part of the region (PR #156262)

via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 19 18:24:08 PDT 2026


================
@@ -9056,15 +9047,27 @@ static SmallVector<Instruction *> preparePlanForEpilogueVectorLoop(
          "ScalarIVSteps when resetting the start value");
   VPBuilder Builder(Header, Header->getFirstNonPhi());
   VPInstruction *Add = Builder.createAdd(IV, VPV);
-  IV->replaceAllUsesWith(Add);
-  Add->setOperand(0, IV);
+  // Replace all users of the canonical IV with the offset version, except for
+  // the Add itself and the canonical IV increment.
+  auto *Increment = vputils::findCanonicalIVIncrement(Plan);
----------------
ayalz wrote:

Worth asserting here that Increment != nullptr, as expected later.

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


More information about the llvm-commits mailing list