diff options
author | Alexey Bataev <a.bataev@outlook.com> | 2023-04-06 11:56:19 -0700 |
---|---|---|
committer | Alexey Bataev <a.bataev@outlook.com> | 2023-04-06 11:57:20 -0700 |
commit | e58a49300e757ff61142f6abd227bd1437c1cf87 (patch) | |
tree | 77578100360ec63a42468bb3b5f1269fdd6adb56 | |
parent | 711c58938f36d91af1dc4209946bcf5e70869445 (diff) | |
download | llvm-e58a49300e757ff61142f6abd227bd1437c1cf87.tar.gz |
[SLP][NFC]Evaluate FMF for reductions before the loop, no need to
reevaluate it.
-rw-r--r-- | llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
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 @@ public: 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 @@ public: 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 = |