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

Gaëtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 08:00:02 PST 2025


================
@@ -2370,6 +2370,23 @@ struct VPFirstOrderRecurrencePHIRecipe : public VPHeaderPHIRecipe {
 #endif
 };
 
+// Possible variants of a reduction.
+
+// This reduction is ordered and in-loop.
+struct RdxOrderedInLoop {};
+// This reduction is in-loop.
+struct RdxInLoop {};
+// This reduction isn't partial, ordered or in-loop.
+struct RdxNormal {};
----------------
gbossu wrote:

Sorry I keep getting more confused I think 😅

I understand that the PHI needs to widened (using a `VPReductionPHIRecipe`). But what update operation needs to be in the loop if the reduction is fully done out-of-loop?

Is the plan to always have an "update" recipe in the loop, even though it turns out to be a nop like a partial reduce from `nxv4i32` to the same `nxv4i32`?

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


More information about the llvm-commits mailing list