@@ -17086,11 +17086,6 @@ static bool isContractableFMUL(const TargetOptions &Options, SDValue N) {
17086
17086
N->getFlags().hasAllowContract();
17087
17087
}
17088
17088
17089
- // Returns true if `N` can assume no infinities involved in its computation.
17090
- static bool hasNoInfs(const TargetOptions &Options, SDValue N) {
17091
- return Options.NoInfsFPMath || N->getFlags().hasNoInfs();
17092
- }
17093
-
17094
17089
/// Try to perform FMA combining on a given FADD node.
17095
17090
template <class MatchContextClass>
17096
17091
SDValue DAGCombiner::visitFADDForFMACombine(SDNode *N) {
@@ -17666,7 +17661,7 @@ SDValue DAGCombiner::visitFMULForFMADistributiveCombine(SDNode *N) {
17666
17661
// The transforms below are incorrect when x == 0 and y == inf, because the
17667
17662
// intermediate multiplication produces a nan.
17668
17663
SDValue FAdd = N0.getOpcode() == ISD::FADD ? N0 : N1;
17669
- if (! hasNoInfs(Options, FAdd ))
17664
+ if (FAdd->getFlags(). hasNoInfs())
17670
17665
return SDValue();
17671
17666
17672
17667
// Floating-point multiply-add without intermediate rounding.
@@ -18343,7 +18338,7 @@ template <class MatchContextClass> SDValue DAGCombiner::visitFMA(SDNode *N) {
18343
18338
return matcher.getNode(ISD::FMA, DL, VT, NegN0, NegN1, N2);
18344
18339
}
18345
18340
18346
- if (( Options.NoNaNsFPMath && Options.NoInfsFPMath) ||
18341
+ if (Options.NoNaNsFPMath ||
18347
18342
(N->getFlags().hasNoNaNs() && N->getFlags().hasNoInfs())) {
18348
18343
if (N->getFlags().hasNoSignedZeros() ||
18349
18344
(N2CFP && !N2CFP->isExactlyValue(-0.0))) {
@@ -18533,7 +18528,6 @@ SDValue DAGCombiner::visitFDIV(SDNode *N) {
18533
18528
SDValue N1 = N->getOperand(1);
18534
18529
EVT VT = N->getValueType(0);
18535
18530
SDLoc DL(N);
18536
- const TargetOptions &Options = DAG.getTarget().Options;
18537
18531
SDNodeFlags Flags = N->getFlags();
18538
18532
SelectionDAG::FlagInserter FlagsInserter(DAG, N);
18539
18533
@@ -18644,7 +18638,7 @@ SDValue DAGCombiner::visitFDIV(SDNode *N) {
18644
18638
}
18645
18639
18646
18640
// Fold into a reciprocal estimate and multiply instead of a real divide.
18647
- if (Options.NoInfsFPMath || Flags.hasNoInfs())
18641
+ if (Flags.hasNoInfs())
18648
18642
if (SDValue RV = BuildDivEstimate(N0, N1, Flags))
18649
18643
return RV;
18650
18644
}
@@ -18721,12 +18715,10 @@ SDValue DAGCombiner::visitFREM(SDNode *N) {
18721
18715
18722
18716
SDValue DAGCombiner::visitFSQRT(SDNode *N) {
18723
18717
SDNodeFlags Flags = N->getFlags();
18724
- const TargetOptions &Options = DAG.getTarget().Options;
18725
18718
18726
18719
// Require 'ninf' flag since sqrt(+Inf) = +Inf, but the estimation goes as:
18727
18720
// sqrt(+Inf) == rsqrt(+Inf) * +Inf = 0 * +Inf = NaN
18728
- if (!Flags.hasApproximateFuncs() ||
18729
- (!Options.NoInfsFPMath && !Flags.hasNoInfs()))
18721
+ if (!Flags.hasApproximateFuncs() || !Flags.hasNoInfs())
18730
18722
return SDValue();
18731
18723
18732
18724
SDValue N0 = N->getOperand(0);
0 commit comments