Skip to content

Commit

Permalink
[SLP][NFC]Evaluate FMF for reductions before the loop, no need to
Browse files Browse the repository at this point in the history
reevaluate it.
  • Loading branch information
alexey-bataev committed Apr 6, 2023
1 parent 711c589 commit e58a493
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit e58a493

Please sign in to comment.