Skip to content

Commit 01389e1

Browse files
committed
[DAGCombiner] Remove UnsafeFPMath usage in visitFSUBForFMACombine
1 parent 494a748 commit 01389e1

File tree

5 files changed

+362
-229
lines changed

5 files changed

+362
-229
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17010,8 +17010,8 @@ SDValue DAGCombiner::visitFSUBForFMACombine(SDNode *N) {
1701017010
return SDValue();
1701117011

1701217012
const SDNodeFlags Flags = N->getFlags();
17013-
bool AllowFusionGlobally = (Options.AllowFPOpFusion == FPOpFusion::Fast ||
17014-
Options.UnsafeFPMath || HasFMAD);
17013+
bool AllowFusionGlobally =
17014+
(Options.AllowFPOpFusion == FPOpFusion::Fast || HasFMAD);
1701517015

1701617016
// If the subtraction is not contractable, do not combine.
1701717017
if (!AllowFusionGlobally && !N->getFlags().hasAllowContract())
@@ -17167,7 +17167,7 @@ SDValue DAGCombiner::visitFSUBForFMACombine(SDNode *N) {
1716717167
}
1716817168

1716917169
auto isReassociable = [&Options](SDNode *N) {
17170-
return Options.UnsafeFPMath || N->getFlags().hasAllowReassociation();
17170+
return N->getFlags().hasAllowReassociation();
1717117171
};
1717217172

1717317173
auto isContractableAndReassociableFMUL = [&isContractableFMUL,
@@ -17181,7 +17181,7 @@ SDValue DAGCombiner::visitFSUBForFMACombine(SDNode *N) {
1718117181

1718217182
// More folding opportunities when target permits.
1718317183
if (Aggressive && isReassociable(N)) {
17184-
bool CanFuse = Options.UnsafeFPMath || N->getFlags().hasAllowContract();
17184+
bool CanFuse = N->getFlags().hasAllowContract();
1718517185
// fold (fsub (fma x, y, (fmul u, v)), z)
1718617186
// -> (fma x, y (fma u, v, (fneg z)))
1718717187
if (CanFuse && isFusedOp(N0) &&

0 commit comments

Comments
 (0)