[llvm] [VPlan] Add VPlan-based addMinIterCheck, replace ILV for non-epilogue. (PR #153643)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 23 06:50:43 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.
----------------
fhahn wrote:
The original code also expanded everything at the end of the entry block, although it was not as clear. Before calling VPExpandSCEVRecipe::execute, the insert point of the build is set the the block's terminator: `State.Builder.SetInsertPoint(Entry->getIRBasicBlock()->getTerminator());`
We can adjust that separately.
https://github.com/llvm/llvm-project/pull/153643
More information about the llvm-commits
mailing list