From: wanglian Date: Fri, 12 Aug 2022 02:08:08 +0000 (+0800) Subject: [LegalizeTypes][NFC] Use getConstantOperandAPInt instead of cast constant getAPInt X-Git-Tag: upstream/17.0.6~36710 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3b71f1d5abaa9a3ee361e581ceb023adc3b0726b;p=platform%2Fupstream%2Fllvm.git [LegalizeTypes][NFC] Use getConstantOperandAPInt instead of cast constant getAPInt Reviewed By: RKSimon Differential Revision: https://reviews.llvm.org/D131653 --- diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp index dc08767..9611c8f 100644 --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp @@ -1555,7 +1555,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_UNDEF(SDNode *N) { SDValue DAGTypeLegalizer::PromoteIntRes_VSCALE(SDNode *N) { EVT VT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0)); - APInt MulImm = cast(N->getOperand(0))->getAPIntValue(); + const APInt &MulImm = N->getConstantOperandAPInt(0); return DAG.getVScale(SDLoc(N), VT, MulImm.sext(VT.getSizeInBits())); } @@ -5352,7 +5352,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_STEP_VECTOR(SDNode *N) { EVT NOutVT = TLI.getTypeToTransformTo(*DAG.getContext(), OutVT); assert(NOutVT.isScalableVector() && "Type must be promoted to a scalable vector type"); - APInt StepVal = cast(N->getOperand(0))->getAPIntValue(); + const APInt &StepVal = N->getConstantOperandAPInt(0); return DAG.getStepVector(dl, NOutVT, StepVal.sext(NOutVT.getScalarSizeInBits())); }