Skip to content

Commit 0891cc1

Browse files
committed
[DAGCombiner] Remove most NoSignedZerosFPMath uses
Remained two uses are related to fneg and foldFPToIntToFP
1 parent 84e4c06 commit 0891cc1

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11849,9 +11849,7 @@ static bool isLegalToCombineMinNumMaxNum(SelectionDAG &DAG, SDValue LHS,
1184911849
if (!VT.isFloatingPoint())
1185011850
return false;
1185111851

11852-
const TargetOptions &Options = DAG.getTarget().Options;
11853-
11854-
return (Flags.hasNoSignedZeros() || Options.NoSignedZerosFPMath) &&
11852+
return Flags.hasNoSignedZeros() &&
1185511853
TLI.isProfitableToCombineMinNumMaxNum(VT) &&
1185611854
(Flags.hasNoNaNs() ||
1185711855
(DAG.isKnownNeverNaN(RHS) && DAG.isKnownNeverNaN(LHS)));
@@ -17351,7 +17349,7 @@ SDValue DAGCombiner::visitFSUBForFMACombine(SDNode *N) {
1735117349
// Always prefer FMAD to FMA for precision.
1735217350
unsigned PreferredFusedOpcode = HasFMAD ? ISD::FMAD : ISD::FMA;
1735317351
bool Aggressive = TLI.enableAggressiveFMAFusion(VT);
17354-
bool NoSignedZero = Options.NoSignedZerosFPMath || Flags.hasNoSignedZeros();
17352+
bool NoSignedZero = Flags.hasNoSignedZeros();
1735517353

1735617354
// Is the node an FMUL and contractable either due to global flags or
1735717355
// SDNodeFlags.
@@ -18327,11 +18325,9 @@ template <class MatchContextClass> SDValue DAGCombiner::visitFMA(SDNode *N) {
1832718325
return matcher.getNode(ISD::FMA, DL, VT, NegN0, NegN1, N2);
1832818326
}
1832918327

18330-
// FIXME: use fast math flags instead of Options.UnsafeFPMath
18331-
// TODO: Finally migrate away from global TargetOptions.
1833218328
if ((Options.NoNaNsFPMath && Options.NoInfsFPMath) ||
1833318329
(N->getFlags().hasNoNaNs() && N->getFlags().hasNoInfs())) {
18334-
if (Options.NoSignedZerosFPMath || N->getFlags().hasNoSignedZeros() ||
18330+
if (N->getFlags().hasNoSignedZeros() ||
1833518331
(N2CFP && !N2CFP->isExactlyValue(-0.0))) {
1833618332
if (N0CFP && N0CFP->isZero())
1833718333
return N2;
@@ -18636,8 +18632,7 @@ SDValue DAGCombiner::visitFDIV(SDNode *N) {
1863618632
}
1863718633

1863818634
// Fold X/Sqrt(X) -> Sqrt(X)
18639-
if ((Options.NoSignedZerosFPMath || Flags.hasNoSignedZeros()) &&
18640-
Flags.hasAllowReassociation())
18635+
if (Flags.hasNoSignedZeros() && Flags.hasAllowReassociation())
1864118636
if (N1.getOpcode() == ISD::FSQRT && N0 == N1.getOperand(0))
1864218637
return N1;
1864318638

0 commit comments

Comments
 (0)