Skip to content

Commit 1edb462

Browse files
committed
Remove UnsafeFPMath in visitFADDForFMACombine
1 parent 12b2652 commit 1edb462

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16914,8 +16914,7 @@ SDValue DAGCombiner::visitFADDForFMACombine(SDNode *N) {
1691416914
// fadd (G, (fma A, B, (fma (C, D, (fmul (E, F)))))) -->
1691516915
// fma A, B, (fma C, D, fma (E, F, G)).
1691616916
// This requires reassociation because it changes the order of operations.
16917-
bool CanReassociate =
16918-
Options.UnsafeFPMath || N->getFlags().hasAllowReassociation();
16917+
bool CanReassociate = N->getFlags().hasAllowReassociation();
1691916918
if (CanReassociate) {
1692016919
SDValue FMA, E;
1692116920
if (isFusedOp(N0) && N0.hasOneUse()) {
@@ -18087,8 +18086,7 @@ template <class MatchContextClass> SDValue DAGCombiner::visitFMA(SDNode *N) {
1808718086
return matcher.getNode(ISD::FMA, DL, VT, NegN0, NegN1, N2);
1808818087
}
1808918088

18090-
// FIXME: use fast math flags instead of Options.UnsafeFPMath
18091-
// TODO: Finally migrate away from global TargetOptions.
18089+
// FIXME: Finally migrate away from global TargetOptions.
1809218090
if (Options.AllowFPOpFusion == FPOpFusion::Fast ||
1809318091
(Options.NoNaNsFPMath && Options.NoInfsFPMath) ||
1809418092
(N->getFlags().hasNoNaNs() && N->getFlags().hasNoInfs())) {
@@ -18112,8 +18110,7 @@ template <class MatchContextClass> SDValue DAGCombiner::visitFMA(SDNode *N) {
1811218110
!DAG.isConstantFPBuildVectorOrConstantFP(N1))
1811318111
return matcher.getNode(ISD::FMA, DL, VT, N1, N0, N2);
1811418112

18115-
bool CanReassociate =
18116-
Options.UnsafeFPMath || N->getFlags().hasAllowReassociation();
18113+
bool CanReassociate = N->getFlags().hasAllowReassociation();
1811718114
if (CanReassociate) {
1811818115
// (fma x, c1, (fmul x, c2)) -> (fmul x, c1+c2)
1811918116
if (matcher.match(N2, ISD::FMUL) && N0 == N2.getOperand(0) &&

0 commit comments

Comments
 (0)