[llvm] [VPlan] Compute interleave count for VPlan. (PR #149702)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 5 02:52:32 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>);
----------------
ayalz wrote:

It may be useful to have an API which filters all reductions among header phi's, to be used for HasReductions, HasSelectCmpReductions, HasOrderedReductions.

https://github.com/llvm/llvm-project/pull/149702


More information about the llvm-commits mailing list