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

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 20 07:02:41 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 {};
----------------
huntergr-arm wrote:

`ComputeReductionResult` should be the final node in the middle block for a normal reduction (or more specialized recipes for AnyOf or Find'X' reductions). But there needs to be a header phi and an update operation inside the loop as well, we just don't reduce across lanes within the vector body.

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


More information about the llvm-commits mailing list