diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp index 83fade45d1892..cc0fd7993916c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp @@ -1026,14 +1026,9 @@ void DAGTypeLegalizer::SplitInteger(SDValue Op, assert(LoVT.getSizeInBits() + HiVT.getSizeInBits() == Op.getValueSizeInBits() && "Invalid integer splitting!"); Lo = DAG.getNode(ISD::TRUNCATE, dl, LoVT, Op); - unsigned ReqShiftAmountInBits = - Log2_32_Ceil(Op.getValueType().getSizeInBits()); - MVT ShiftAmountTy = - TLI.getScalarShiftAmountTy(DAG.getDataLayout(), Op.getValueType()); - if (ReqShiftAmountInBits > ShiftAmountTy.getSizeInBits()) - ShiftAmountTy = MVT::getIntegerVT(NextPowerOf2(ReqShiftAmountInBits)); - Hi = DAG.getNode(ISD::SRL, dl, Op.getValueType(), Op, - DAG.getConstant(LoVT.getSizeInBits(), dl, ShiftAmountTy)); + Hi = DAG.getNode( + ISD::SRL, dl, Op.getValueType(), Op, + DAG.getShiftAmountConstant(LoVT.getSizeInBits(), Op.getValueType(), dl)); Hi = DAG.getNode(ISD::TRUNCATE, dl, HiVT, Hi); }