[llvm] [VPlan] Skip epilogue vectorization if dead after narrowing IGs. (PR #187016)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 17 08:01:18 PDT 2026
================
@@ -4463,6 +4463,28 @@ VectorizationFactor LoopVectorizationPlanner::selectEpilogueVectorizationFactor(
return Result;
}
+ // Check if a plan's vector loop processes fewer iterations than VF (e.g. when
+ // interleave groups have been narrowed) narrowInterleaveGroups) and return
+ // the adjusted, effective VF.
+ using namespace VPlanPatternMatch;
+ auto GetEffectiveVF = [](VPlan &Plan, ElementCount VF) -> ElementCount {
+ auto *CanIV = Plan.getVectorLoopRegion()->getCanonicalIV();
+ auto *Exiting = Plan.getVectorLoopRegion()->getExitingBasicBlock();
+ if (match(
+ &Exiting->back(),
+ m_BranchOnCount(m_Add(m_Specific(CanIV), m_Specific(&Plan.getUF())),
+ m_VPValue())))
----------------
artagnon wrote:
Is this the best way to check that narrowInterleaveGroups has done something? Doesn't it return a fresh VPlan, from which we can get the "effective VF" directly?
https://github.com/llvm/llvm-project/pull/187016
More information about the llvm-commits
mailing list