Skip to content

Commit b8f560f

Browse files
authored
[LegalizeTypes] Use APFloat::getZero instead of passing a zero APInt to APFloat constructor. NFC (#103492)
1 parent 4f5d866 commit b8f560f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,8 +1774,7 @@ void DAGTypeLegalizer::ExpandFloatRes_FP_EXTEND(SDNode *N, SDValue &Lo,
17741774
Hi = DAG.getNode(ISD::FP_EXTEND, dl, NVT, N->getOperand(0));
17751775
}
17761776

1777-
Lo = DAG.getConstantFP(
1778-
APFloat(NVT.getFltSemantics(), APInt(NVT.getSizeInBits(), 0)), dl, NVT);
1777+
Lo = DAG.getConstantFP(APFloat::getZero(NVT.getFltSemantics()), dl, NVT);
17791778

17801779
if (IsStrict)
17811780
ReplaceValueWith(SDValue(N, 1), Chain);
@@ -1931,8 +1930,7 @@ void DAGTypeLegalizer::ExpandFloatRes_LOAD(SDNode *N, SDValue &Lo,
19311930
Chain = Hi.getValue(1);
19321931

19331932
// The low part is zero.
1934-
Lo = DAG.getConstantFP(
1935-
APFloat(NVT.getFltSemantics(), APInt(NVT.getSizeInBits(), 0)), dl, NVT);
1933+
Lo = DAG.getConstantFP(APFloat::getZero(NVT.getFltSemantics()), dl, NVT);
19361934

19371935
// Modified the chain - switch anything that used the old chain to use the
19381936
// new one.
@@ -1961,8 +1959,7 @@ void DAGTypeLegalizer::ExpandFloatRes_XINT_TO_FP(SDNode *N, SDValue &Lo,
19611959
// though.
19621960
if (SrcVT.bitsLE(MVT::i32)) {
19631961
// The integer can be represented exactly in an f64.
1964-
Lo = DAG.getConstantFP(
1965-
APFloat(NVT.getFltSemantics(), APInt(NVT.getSizeInBits(), 0)), dl, NVT);
1962+
Lo = DAG.getConstantFP(APFloat::getZero(NVT.getFltSemantics()), dl, NVT);
19661963
if (Strict) {
19671964
Hi = DAG.getNode(N->getOpcode(), dl, DAG.getVTList(NVT, MVT::Other),
19681965
{Chain, Src}, Flags);

0 commit comments

Comments
 (0)