[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
================
@@ -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;
+ }
----------------
alexey-bataev wrote:
No need for this function, if you'll preserve the order during building list of the values/operands. That's why I asked to separate this from the existing processing for the associative reduction
https://github.com/llvm/llvm-project/pull/146570
More information about the llvm-commits
mailing list