@@ -17759,7 +17759,6 @@ SDValue DAGCombiner::visitFADD(SDNode *N) {
1775917759 bool N1CFP = DAG.isConstantFPBuildVectorOrConstantFP(N1);
1776017760 EVT VT = N->getValueType(0);
1776117761 SDLoc DL(N);
17762- const TargetOptions &Options = DAG.getTarget().Options;
1776317762 SDNodeFlags Flags = N->getFlags();
1776417763 SelectionDAG::FlagInserter FlagsInserter(DAG, N);
1776517764
@@ -17825,7 +17824,7 @@ SDValue DAGCombiner::visitFADD(SDNode *N) {
1782517824 bool AllowNewConst = (Level < AfterLegalizeDAG);
1782617825
1782717826 // If nnan is enabled, fold lots of things.
17828- if ((Options.NoNaNsFPMath || Flags.hasNoNaNs() ) && AllowNewConst) {
17827+ if (Flags.hasNoNaNs() && AllowNewConst) {
1782917828 // If allowed, fold (fadd (fneg x), x) -> 0.0
1783017829 if (N0.getOpcode() == ISD::FNEG && N0.getOperand(0) == N1)
1783117830 return DAG.getConstantFP(0.0, DL, VT);
@@ -17974,7 +17973,6 @@ SDValue DAGCombiner::visitFSUB(SDNode *N) {
1797417973 ConstantFPSDNode *N1CFP = isConstOrConstSplatFP(N1, true);
1797517974 EVT VT = N->getValueType(0);
1797617975 SDLoc DL(N);
17977- const TargetOptions &Options = DAG.getTarget().Options;
1797817976 const SDNodeFlags Flags = N->getFlags();
1797917977 SelectionDAG::FlagInserter FlagsInserter(DAG, N);
1798017978
@@ -18002,7 +18000,7 @@ SDValue DAGCombiner::visitFSUB(SDNode *N) {
1800218000
1800318001 if (N0 == N1) {
1800418002 // (fsub x, x) -> 0.0
18005- if (Options.NoNaNsFPMath || Flags.hasNoNaNs())
18003+ if (Flags.hasNoNaNs())
1800618004 return DAG.getConstantFP(0.0f, DL, VT);
1800718005 }
1800818006
@@ -18313,7 +18311,6 @@ template <class MatchContextClass> SDValue DAGCombiner::visitFMA(SDNode *N) {
1831318311 ConstantFPSDNode *N2CFP = dyn_cast<ConstantFPSDNode>(N2);
1831418312 EVT VT = N->getValueType(0);
1831518313 SDLoc DL(N);
18316- const TargetOptions &Options = DAG.getTarget().Options;
1831718314 // FMA nodes have flags that propagate to the created nodes.
1831818315 SelectionDAG::FlagInserter FlagsInserter(DAG, N);
1831918316 MatchContextClass matcher(DAG, TLI, N);
@@ -18339,8 +18336,7 @@ template <class MatchContextClass> SDValue DAGCombiner::visitFMA(SDNode *N) {
1833918336 return matcher.getNode(ISD::FMA, DL, VT, NegN0, NegN1, N2);
1834018337 }
1834118338
18342- if ((Options.NoNaNsFPMath && N->getFlags().hasNoInfs()) ||
18343- (N->getFlags().hasNoNaNs() && N->getFlags().hasNoInfs())) {
18339+ if (N->getFlags().hasNoNaNs() && N->getFlags().hasNoInfs()) {
1834418340 if (N->getFlags().hasNoSignedZeros() ||
1834518341 (N2CFP && !N2CFP->isExactlyValue(-0.0))) {
1834618342 if (N0CFP && N0CFP->isZero())
0 commit comments