Skip to content

Commit b277841

Browse files
committed
remove UnsafeFPMath usage in visitFDIV
1 parent 8aa53e4 commit b277841

File tree

6 files changed

+2358
-1853
lines changed

6 files changed

+2358
-1853
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18237,8 +18237,7 @@ SDValue DAGCombiner::visitFDIV(SDNode *N) {
1823718237
// Only do the transform if the reciprocal is a legal fp immediate that
1823818238
// isn't too nasty (eg NaN, denormal, ...).
1823918239
if (((st == APFloat::opOK && !Recip.isDenormal()) ||
18240-
(st == APFloat::opInexact &&
18241-
(Options.UnsafeFPMath || Flags.hasAllowReciprocal()))) &&
18240+
(st == APFloat::opInexact && Flags.hasAllowReciprocal())) &&
1824218241
(!LegalOperations ||
1824318242
// FIXME: custom lowering of ConstantFP might fail (see e.g. ARM
1824418243
// backend)... we should handle this gracefully after Legalize.
@@ -18249,7 +18248,7 @@ SDValue DAGCombiner::visitFDIV(SDNode *N) {
1824918248
DAG.getConstantFP(Recip, DL, VT));
1825018249
}
1825118250

18252-
if (Options.UnsafeFPMath || Flags.hasAllowReciprocal()) {
18251+
if (Flags.hasAllowReciprocal()) {
1825318252
// If this FDIV is part of a reciprocal square root, it may be folded
1825418253
// into a target-specific square root estimate instruction.
1825518254
if (N1.getOpcode() == ISD::FSQRT) {
@@ -18324,7 +18323,7 @@ SDValue DAGCombiner::visitFDIV(SDNode *N) {
1832418323

1832518324
// Fold X/Sqrt(X) -> Sqrt(X)
1832618325
if ((Options.NoSignedZerosFPMath || Flags.hasNoSignedZeros()) &&
18327-
(Options.UnsafeFPMath || Flags.hasAllowReassociation()))
18326+
Flags.hasAllowReassociation())
1832818327
if (N1.getOpcode() == ISD::FSQRT && N0 == N1.getOperand(0))
1832918328
return N1;
1833018329

0 commit comments

Comments
 (0)