[PATCH] D131653: [LegalizeTypes][NFC] Use getConstantOperandAPInt instead of cast constant getAPInt
WangLian via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 10 23:36:07 PDT 2022
Jimerlife created this revision.
Jimerlife added reviewers: craig.topper, sdesmalen, RKSimon, frasercrmck, benshi001.
Jimerlife added a project: LLVM.
Herald added subscribers: StephenFan, hiraditya.
Herald added a project: All.
Jimerlife requested review of this revision.
Herald added subscribers: llvm-commits, jacquesguan.
Use `getConstantOperandAPInt(Num)` instead of `cast<ConstantSDNode>(N->getOperand(Num))->getAPIntValue()`
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D131653
Files:
llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -1555,7 +1555,7 @@
SDValue DAGTypeLegalizer::PromoteIntRes_VSCALE(SDNode *N) {
EVT VT = TLI.getTypeToTransformTo(*DAG.getContext(), N->getValueType(0));
- APInt MulImm = cast<ConstantSDNode>(N->getOperand(0))->getAPIntValue();
+ APInt MulImm = N->getConstantOperandAPInt(0);
return DAG.getVScale(SDLoc(N), VT, MulImm.sext(VT.getSizeInBits()));
}
@@ -5352,7 +5352,7 @@
EVT NOutVT = TLI.getTypeToTransformTo(*DAG.getContext(), OutVT);
assert(NOutVT.isScalableVector() &&
"Type must be promoted to a scalable vector type");
- APInt StepVal = cast<ConstantSDNode>(N->getOperand(0))->getAPIntValue();
+ APInt StepVal = N->getConstantOperandAPInt(0);
return DAG.getStepVector(dl, NOutVT,
StepVal.sext(NOutVT.getScalarSizeInBits()));
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131653.451742.patch
Type: text/x-patch
Size: 1044 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220811/5060ab35/attachment.bin>
More information about the llvm-commits
mailing list