[llvm] [LV] Use VPReductionRecipe for partial reductions (PR #147513)
Sam Tebbs via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 26 03:26:31 PST 2025
================
@@ -2392,6 +2392,29 @@ struct VPFirstOrderRecurrencePHIRecipe : public VPHeaderPHIRecipe {
#endif
};
+// Possible variants of a reduction.
+
+// This reduction is ordered and in-loop.
+struct RdxOrdered {};
+// This reduction is in-loop.
+struct RdxInLoop {};
+// This reduction is unordered with the partial result scaled down by some
+// factor.
+struct RdxUnordered {
+ unsigned VFScaleFactor;
+};
+using ReductionStyle = std::variant<RdxOrdered, RdxInLoop, RdxUnordered>;
+
+static ReductionStyle getReductionStyle(bool InLoop, bool Ordered,
+ unsigned ScaleFactor) {
+ assert((!Ordered || InLoop) && "Ordered implies in-loop");
+ if (Ordered)
+ return RdxOrdered{};
+ if (InLoop)
+ return RdxInLoop{};
+ return RdxUnordered{/*VFScaleFactor=*/ScaleFactor};
+}
+
----------------
SamTebbs33 wrote:
Done.
https://github.com/llvm/llvm-project/pull/147513
More information about the llvm-commits
mailing list