Skip to content

Commit 9762c91

Browse files
committed
[LoopVectorize] Use recurrence kind to determine FMF instead of isa<FPMathOperator>
Replace isa<FPMathOperator>(CurrentLinkI) with RecurrenceDescriptor::isFloatingPointRecurrenceKind(Kind) to determine whether to use FastMathFlags. This uses information already available at the VPlan level instead of inspecting the underlying instruction type.
1 parent 8a055f8 commit 9762c91

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8759,9 +8759,10 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
87598759
RecurrenceDescriptor RdxDesc = Legal->getRecurrenceDescriptor(
87608760
cast<PHINode>(PhiR->getUnderlyingInstr()));
87618761
// Non-FP RdxDescs will have all fast math flags set, so clear them.
8762-
FastMathFlags FMFs = isa<FPMathOperator>(CurrentLinkI)
8763-
? RdxDesc.getFastMathFlags()
8764-
: FastMathFlags();
8762+
FastMathFlags FMFs =
8763+
RecurrenceDescriptor::isFloatingPointRecurrenceKind(Kind)
8764+
? RdxDesc.getFastMathFlags()
8765+
: FastMathFlags();
87658766
auto *RedRecipe = new VPReductionRecipe(
87668767
Kind, FMFs, CurrentLinkI, PreviousLink, VecOp, CondOp,
87678768
PhiR->isOrdered(), CurrentLinkI->getDebugLoc());

0 commit comments

Comments
 (0)