[llvm-branch-commits] [llvm] [LoopVectorizer] Bundle partial reductions inside VPMulAccumulateReductionRecipe (PR #136173)

Sam Tebbs via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Apr 30 08:07:30 PDT 2025


================
@@ -2432,12 +2437,40 @@ static void tryToCreateAbstractReductionRecipe(VPReductionRecipe *Red,
   Red->replaceAllUsesWith(AbstractR);
 }
 
+/// This function tries to create an abstract recipe from a partial reduction to
+/// hide its mul and extends from cost estimation.
+static void
+tryToCreateAbstractPartialReductionRecipe(VPPartialReductionRecipe *PRed) {
----------------
SamTebbs33 wrote:

At this point we've already created the partial reduction and clamped the range so I don't think we need to do any costing (like `tryToMatchAndCreateMulAccumulateReduction` does with `getMulAccReductionCost`) since we already know it's worthwhile (see `getScaledReductions` in LoopVectorize.cpp). This part of the code just puts the partial reduction inside the abstract recipe, which shouldn't need to consider any costing.

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


More information about the llvm-branch-commits mailing list