[llvm] [SLP] Support ordered FAdd reductions in SLPVectorizer (PR #146570)

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 9 09:59:19 PDT 2025


================
@@ -21774,6 +21784,8 @@ class HorizontalReduction {
   /// signedness.
   SmallVector<std::tuple<Value *, unsigned, bool>> VectorValuesAndScales;
 
+  SmallVector<Value *, 2> InitialFAddValues;
+
----------------
alexey-bataev wrote:

Why do you need this? What you need to do, is just follow left- or right-associated reduction tree form and just keep the ordered of the reduced values and the reduction ops.

I.e. for you only something like `(v1 + (v2 + ... + (vn-1 + vn)))))` or `((((v1 + v2) + ... + vn-1) + vn)` should be vectorized, all other cases are not ordered

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


More information about the llvm-commits mailing list