Skip to content

Commit 58083ac

Browse files
paperchalicemahesh-attarde
authored andcommitted
[TargetLowering] Remove NoSignedZerosFPMath uses (llvm#160975)
Remove NoSignedZerosFPMath in TargetLowering part, users should always use instruction level fast math flags.
1 parent 478b794 commit 58083ac

File tree

6 files changed

+432
-185
lines changed

6 files changed

+432
-185
lines changed

llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7492,7 +7492,6 @@ SDValue TargetLowering::getNegatedExpression(SDValue Op, SelectionDAG &DAG,
74927492
// Pre-increment recursion depth for use in recursive calls.
74937493
++Depth;
74947494
const SDNodeFlags Flags = Op->getFlags();
7495-
const TargetOptions &Options = DAG.getTarget().Options;
74967495
EVT VT = Op.getValueType();
74977496
unsigned Opcode = Op.getOpcode();
74987497

@@ -7572,7 +7571,7 @@ SDValue TargetLowering::getNegatedExpression(SDValue Op, SelectionDAG &DAG,
75727571
return DAG.getBuildVector(VT, DL, Ops);
75737572
}
75747573
case ISD::FADD: {
7575-
if (!Options.NoSignedZerosFPMath && !Flags.hasNoSignedZeros())
7574+
if (!Flags.hasNoSignedZeros())
75767575
break;
75777576

75787577
// After operation legalization, it might not be legal to create new FSUBs.
@@ -7617,7 +7616,7 @@ SDValue TargetLowering::getNegatedExpression(SDValue Op, SelectionDAG &DAG,
76177616
}
76187617
case ISD::FSUB: {
76197618
// We can't turn -(A-B) into B-A when we honor signed zeros.
7620-
if (!Options.NoSignedZerosFPMath && !Flags.hasNoSignedZeros())
7619+
if (!Flags.hasNoSignedZeros())
76217620
break;
76227621

76237622
SDValue X = Op.getOperand(0), Y = Op.getOperand(1);
@@ -7678,7 +7677,7 @@ SDValue TargetLowering::getNegatedExpression(SDValue Op, SelectionDAG &DAG,
76787677
}
76797678
case ISD::FMA:
76807679
case ISD::FMAD: {
7681-
if (!Options.NoSignedZerosFPMath && !Flags.hasNoSignedZeros())
7680+
if (!Flags.hasNoSignedZeros())
76827681
break;
76837682

76847683
SDValue X = Op.getOperand(0), Y = Op.getOperand(1), Z = Op.getOperand(2);
@@ -8797,7 +8796,6 @@ SDValue TargetLowering::expandFMINIMUMNUM_FMAXIMUMNUM(SDNode *Node,
87978796
EVT VT = Node->getValueType(0);
87988797
EVT CCVT = getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), VT);
87998798
bool IsMax = Opc == ISD::FMAXIMUMNUM;
8800-
const TargetOptions &Options = DAG.getTarget().Options;
88018799
SDNodeFlags Flags = Node->getFlags();
88028800

88038801
unsigned NewOp =
@@ -8858,8 +8856,8 @@ SDValue TargetLowering::expandFMINIMUMNUM_FMAXIMUMNUM(SDNode *Node,
88588856
// TODO: We need quiet sNaN if strictfp.
88598857

88608858
// Fixup signed zero behavior.
8861-
if (Options.NoSignedZerosFPMath || Flags.hasNoSignedZeros() ||
8862-
DAG.isKnownNeverZeroFloat(LHS) || DAG.isKnownNeverZeroFloat(RHS)) {
8859+
if (Flags.hasNoSignedZeros() || DAG.isKnownNeverZeroFloat(LHS) ||
8860+
DAG.isKnownNeverZeroFloat(RHS)) {
88638861
return MinMax;
88648862
}
88658863
SDValue TestZero =

0 commit comments

Comments
 (0)