[llvm] [VPlan] Add VPlan-based addMinIterCheck, replace ILV for non-epilogue. (PR #153643)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 21 08:45:59 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:
It is unusual to add recipes to a VPBB after (some of) its recipes have executed. Could the expansion of SCEVs take place as a VPlan-to-VPlan transformation, replacing each ExpandSCEV recipe by several recipes wrapping the generated Instructions. The position of the replacement recipes is fixed based on retaining their existing Instructions in place rather than maintaining their (possibly non existent) def/use dependencies. This effectively turns ExpandSCEV into an abstract execute-less recipe.
https://github.com/llvm/llvm-project/pull/153643
More information about the llvm-commits
mailing list