[llvm] [VPlan] Add VPlan-based addMinIterCheck, replace ILV for non-epilogue. (PR #153643)

via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 22 00:39:29 PDT 2025


================
@@ -7327,6 +7257,17 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
       BestVPlan.resetTripCount(Exp);
     ExpSCEV->eraseFromParent();
   }
+  // SCEV expansion will add new instructions in the IRBB wrapped by Entry.
+  // Remove existing VPIRInstructions/VPIRPhi and re-create them to make sure
+  // all IR instructions are wrapped. Otherwise VPInstructions may be inserted
+  // at the wrong place.
----------------
ayalz wrote:

Another, simpler option is to have ExpandSCEV recipe represent all the Instructions generated when it first executes, and have it bump the builder's insertion point after its last Instruction when it executes the second time - this time during execution of the entire block/plan, as in VPIRInstruction's execute.

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


More information about the llvm-commits mailing list