[llvm] [LV] Use VPReductionRecipe for partial reductions (PR #147513)

Gaƫtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 06:41:42 PST 2025


================
@@ -8772,9 +8788,12 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
       FastMathFlags FMFs = isa<FPMathOperator>(CurrentLinkI)
                                ? RdxDesc.getFastMathFlags()
                                : FastMathFlags();
-      auto *RedRecipe = new VPReductionRecipe(
-          Kind, FMFs, CurrentLinkI, PreviousLink, VecOp, CondOp,
-          PhiR->isOrdered(), CurrentLinkI->getDebugLoc());
+      bool UseOrderedReductions = PhiR->isOrdered();
+      RdxStyle Style = UseOrderedReductions ? RdxStyle(RdxOrderedInLoop{})
+                                            : RdxStyle(RdxInLoop{});
----------------
gbossu wrote:

Nit: This could also use the `ReductionStyle::get` helper.

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


More information about the llvm-commits mailing list