[llvm] [VPlan] Compute interleave count for VPlan. (PR #149702)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 5 02:52:31 PDT 2025
================
@@ -4686,15 +4679,20 @@ LoopVectorizationCostModel::selectInterleaveCount(VPlan &Plan, ElementCount VF,
// We don't attempt to perform interleaving for loops with uncountable early
// exits because the VPInstruction::AnyOf code cannot currently handle
// multiple parts.
- if (Legal->hasUncountableEarlyExit())
+ if (Plan.hasEarlyExit())
return 1;
- const bool HasReductions = !Legal->getReductionVars().empty();
+ const bool HasReductions =
+ any_of(Plan.getVectorLoopRegion()->getEntryBasicBlock()->phis(),
+ IsaPred<VPReductionPHIRecipe>);
// If we did not calculate the cost for VF (because the user selected the VF)
// then we calculate the cost of VF here.
if (LoopCost == 0) {
- LoopCost = expectedCost(VF);
+ if (VF.isScalar())
+ LoopCost = CM.expectedCost(VF);
+ else
+ LoopCost = cost(Plan, VF);
----------------
ayalz wrote:
nit: trinary?
https://github.com/llvm/llvm-project/pull/149702
More information about the llvm-commits
mailing list