[llvm] [LV] Add epilogue minimum iteration check in VPlan as well. (PR #189372)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 31 06:22:54 PDT 2026
================
@@ -9817,18 +9665,51 @@ bool LoopVectorizePass::processLoop(Loop *L) {
preparePlanForMainVectorLoop(*BestMainPlan, BestEpiPlan);
EpilogueLoopVectorizationInfo EPI(VF.Width, IC, EpilogueVF.Width, 1,
BestEpiPlan);
+
+ // Add minimum iteration check for the epilogue plan, followed by runtime
+ // checks for the main plan.
+ LVP.addMinimumIterationCheck(*BestMainPlan, EPI.EpilogueVF, EPI.EpilogueUF,
+ ElementCount::getFixed(0));
+ bool HasBranchWeights =
+ hasBranchWeightMD(*L->getLoopLatch()->getTerminator());
+ LVP.attachRuntimeChecks(*BestMainPlan, Checks, HasBranchWeights);
+ LVP.addIterationCountCheckBlock(*BestMainPlan, EPI.MainLoopVF,
+ EPI.MainLoopUF);
----------------
artagnon wrote:
Could pass the BranchWeights here directly, simplifying and possibly eliminating LoopVectorizationPlanner::addIterationCountCheckBlock altogether?
https://github.com/llvm/llvm-project/pull/189372
More information about the llvm-commits
mailing list