[llvm] e58a493 - [SLP][NFC]Evaluate FMF for reductions before the loop, no need to
Alexey Bataev via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 6 11:59:56 PDT 2023
Author: Alexey Bataev
Date: 2023-04-06T11:57:20-07:00
New Revision: e58a49300e757ff61142f6abd227bd1437c1cf87
URL: https://github.com/llvm/llvm-project/commit/e58a49300e757ff61142f6abd227bd1437c1cf87
DIFF: https://github.com/llvm/llvm-project/commit/e58a49300e757ff61142f6abd227bd1437c1cf87.diff
LOG: [SLP][NFC]Evaluate FMF for reductions before the loop, no need to
reevaluate it.
Added:
Modified:
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index a7b2bbbfca17..7828b5698ee7 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -13037,6 +13037,12 @@ class HorizontalReduction {
continue;
IgnoreList.insert(RdxOp);
}
+ // Intersect the fast-math-flags from all reduction operations.
+ FastMathFlags RdxFMF;
+ RdxFMF.set();
+ for (Value *U : IgnoreList)
+ if (auto *FPMO = dyn_cast<FPMathOperator>(U))
+ RdxFMF &= FPMO->getFastMathFlags();
bool IsCmpSelMinMax = isCmpSelMinMax(cast<Instruction>(ReductionRoot));
// Need to track reduced vals, they may be changed during vectorization of
@@ -13297,12 +13303,6 @@ class HorizontalReduction {
V.computeMinimumValueSizes();
- // Intersect the fast-math-flags from all reduction operations.
- FastMathFlags RdxFMF;
- RdxFMF.set();
- for (Value *U : IgnoreList)
- if (auto *FPMO = dyn_cast<FPMathOperator>(U))
- RdxFMF &= FPMO->getFastMathFlags();
// Estimate cost.
InstructionCost TreeCost = V.getTreeCost(VL);
InstructionCost ReductionCost =
More information about the llvm-commits
mailing list