Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0ca54d7

Browse files
authored
[LegalizeTypes] Use getShiftAmountConstant in SplitInteger. (llvm#158392)
This function contained old code for handling the case that the type returned getScalarShiftAmountTy can't hold the shift amount. These days this is handled by getShiftAmountTy which is used by getShiftAmountConstant.
1 parent 7aad383 commit 0ca54d7

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,14 +1026,9 @@ void DAGTypeLegalizer::SplitInteger(SDValue Op,
10261026
assert(LoVT.getSizeInBits() + HiVT.getSizeInBits() ==
10271027
Op.getValueSizeInBits() && "Invalid integer splitting!");
10281028
Lo = DAG.getNode(ISD::TRUNCATE, dl, LoVT, Op);
1029-
unsigned ReqShiftAmountInBits =
1030-
Log2_32_Ceil(Op.getValueType().getSizeInBits());
1031-
MVT ShiftAmountTy =
1032-
TLI.getScalarShiftAmountTy(DAG.getDataLayout(), Op.getValueType());
1033-
if (ReqShiftAmountInBits > ShiftAmountTy.getSizeInBits())
1034-
ShiftAmountTy = MVT::getIntegerVT(NextPowerOf2(ReqShiftAmountInBits));
1035-
Hi = DAG.getNode(ISD::SRL, dl, Op.getValueType(), Op,
1036-
DAG.getConstant(LoVT.getSizeInBits(), dl, ShiftAmountTy));
1029+
Hi = DAG.getNode(
1030+
ISD::SRL, dl, Op.getValueType(), Op,
1031+
DAG.getShiftAmountConstant(LoVT.getSizeInBits(), Op.getValueType(), dl));
10371032
Hi = DAG.getNode(ISD::TRUNCATE, dl, HiVT, Hi);
10381033
}
10391034

0 commit comments

Comments
 (0)