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

via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 20 10:13:19 PDT 2025


================
@@ -22066,6 +22089,68 @@ class HorizontalReduction {
            (I && !isa<LoadInst>(I) && isValidForAlternation(I->getOpcode()));
   }
 
+  bool checkOperandsOrder() const {
+    auto OpsVec = reverse(ReductionOps[0]);
+    if (!isOrderedFaddReduction() || empty(OpsVec))
+      return false;
+    Value *PrevOperand = *OpsVec.begin();
+    for (auto *I : drop_begin(OpsVec)) {
+      Value *Op1 = cast<BinaryOperator>(I)->getOperand(0);
+      if (Op1 != PrevOperand)
+        return false;
+      PrevOperand = I;
+    }
+    return true;
+  }
----------------
sc-clulzze wrote:

Sorry for a long reply, I reworked logic for non-associative matching completly, and got rid of all the changes inside associative matching logic

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


More information about the llvm-commits mailing list