Skip to content

Commit e58a493

Browse files
committed
[SLP][NFC]Evaluate FMF for reductions before the loop, no need to
reevaluate it.
1 parent 711c589 commit e58a493

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13037,6 +13037,12 @@ class HorizontalReduction {
1303713037
continue;
1303813038
IgnoreList.insert(RdxOp);
1303913039
}
13040+
// Intersect the fast-math-flags from all reduction operations.
13041+
FastMathFlags RdxFMF;
13042+
RdxFMF.set();
13043+
for (Value *U : IgnoreList)
13044+
if (auto *FPMO = dyn_cast<FPMathOperator>(U))
13045+
RdxFMF &= FPMO->getFastMathFlags();
1304013046
bool IsCmpSelMinMax = isCmpSelMinMax(cast<Instruction>(ReductionRoot));
1304113047

1304213048
// Need to track reduced vals, they may be changed during vectorization of
@@ -13297,12 +13303,6 @@ class HorizontalReduction {
1329713303

1329813304
V.computeMinimumValueSizes();
1329913305

13300-
// Intersect the fast-math-flags from all reduction operations.
13301-
FastMathFlags RdxFMF;
13302-
RdxFMF.set();
13303-
for (Value *U : IgnoreList)
13304-
if (auto *FPMO = dyn_cast<FPMathOperator>(U))
13305-
RdxFMF &= FPMO->getFastMathFlags();
1330613306
// Estimate cost.
1330713307
InstructionCost TreeCost = V.getTreeCost(VL);
1330813308
InstructionCost ReductionCost =

0 commit comments

Comments
 (0)