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

Sam Tebbs via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 08:08:51 PST 2025


================
@@ -2731,8 +2602,16 @@ void VPReductionRecipe::execute(VPTransformState &State) {
           PrevInChain, NewVecOp);
     PrevInChain = NewRed;
     NextInChain = NewRed;
+  } else if (isPartialReduction()) {
+    assert(Kind == RecurKind::Add && "Unexpected partial reduction kind");
+    Value *PrevInChain = State.get(getChainOp(), /*IsScalar*/ false);
+    NewRed = State.Builder.CreateIntrinsic(
+        PrevInChain->getType(), Intrinsic::vector_partial_reduce_add,
+        {PrevInChain, NewVecOp}, nullptr, "partial.reduce");
+    PrevInChain = NewRed;
+    NextInChain = NewRed;
   } else {
----------------
SamTebbs33 wrote:

Done.

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


More information about the llvm-commits mailing list