Skip to content

Commit be76f16

Browse files
[Target] Use getConstantOperandAPInt (NFC)
1 parent 12bba0d commit be76f16

File tree

4 files changed

+7
-13
lines changed

4 files changed

+7
-13
lines changed

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4513,8 +4513,7 @@ static SDValue skipExtensionForVectorMULL(SDValue N, SelectionDAG &DAG) {
45134513
SDLoc dl(N);
45144514
SmallVector<SDValue, 8> Ops;
45154515
for (unsigned i = 0; i != NumElts; ++i) {
4516-
ConstantSDNode *C = cast<ConstantSDNode>(N.getOperand(i));
4517-
const APInt &CInt = C->getAPIntValue();
4516+
const APInt &CInt = N.getConstantOperandAPInt(i);
45184517
// Element types smaller than 32 bits are not legal, so use i32 elements.
45194518
// The values are implicitly truncated so sext vs. zext doesn't matter.
45204519
Ops.push_back(DAG.getConstant(CInt.zextOrTrunc(32), dl, MVT::i32));

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9577,8 +9577,7 @@ static SDValue SkipExtensionForVMULL(SDNode *N, SelectionDAG &DAG) {
95779577
SmallVector<SDValue, 8> Ops;
95789578
SDLoc dl(N);
95799579
for (unsigned i = 0; i != NumElts; ++i) {
9580-
ConstantSDNode *C = cast<ConstantSDNode>(N->getOperand(i));
9581-
const APInt &CInt = C->getAPIntValue();
9580+
const APInt &CInt = N->getConstantOperandAPInt(i);
95829581
// Element types smaller than 32 bits are not legal, so use i32 elements.
95839582
// The values are implicitly truncated so sext vs. zext doesn't matter.
95849583
Ops.push_back(DAG.getConstant(CInt.zextOrTrunc(32), dl, MVT::i32));
@@ -18080,8 +18079,7 @@ SDValue ARMTargetLowering::PerformCMOVToBFICombine(SDNode *CMOV, SelectionDAG &D
1808018079

1808118080
SDValue Op0 = CMOV->getOperand(0);
1808218081
SDValue Op1 = CMOV->getOperand(1);
18083-
auto CCNode = cast<ConstantSDNode>(CMOV->getOperand(2));
18084-
auto CC = CCNode->getAPIntValue().getLimitedValue();
18082+
auto CC = CMOV->getConstantOperandAPInt(2).getLimitedValue();
1808518083
SDValue CmpZ = CMOV->getOperand(4);
1808618084

1808718085
// The compare must be against zero.
@@ -20109,8 +20107,7 @@ void ARMTargetLowering::computeKnownBitsForTargetNode(const SDValue Op,
2010920107

2011020108
// The operand to BFI is already a mask suitable for removing the bits it
2011120109
// sets.
20112-
ConstantSDNode *CI = cast<ConstantSDNode>(Op.getOperand(2));
20113-
const APInt &Mask = CI->getAPIntValue();
20110+
const APInt &Mask = Op.getConstantOperandAPInt(2);
2011420111
Known.Zero &= Mask;
2011520112
Known.One &= Mask;
2011620113
return;

llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2019,9 +2019,7 @@ SDValue NVPTXTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
20192019
DL, RetTy, Args, Outs, retAlignment,
20202020
HasVAArgs
20212021
? std::optional<std::pair<unsigned, const APInt &>>(std::make_pair(
2022-
CLI.NumFixedArgs,
2023-
cast<ConstantSDNode>(VADeclareParam->getOperand(1))
2024-
->getAPIntValue()))
2022+
CLI.NumFixedArgs, VADeclareParam->getConstantOperandAPInt(1)))
20252023
: std::nullopt,
20262024
*CB, UniqueCallSite);
20272025
const char *ProtoStr = nvTM->getStrPool().save(Proto).data();

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4822,8 +4822,8 @@ static bool getTargetConstantBitsFromNode(SDValue Op, unsigned EltSizeInBits,
48224822

48234823
APInt UndefSrcElts(NumSrcElts, 0);
48244824
SmallVector<APInt, 64> SrcEltBits;
4825-
auto *CN = cast<ConstantSDNode>(Op.getOperand(0).getOperand(0));
4826-
SrcEltBits.push_back(CN->getAPIntValue().zextOrTrunc(SrcEltSizeInBits));
4825+
const APInt &C = Op.getOperand(0).getConstantOperandAPInt(0);
4826+
SrcEltBits.push_back(C.zextOrTrunc(SrcEltSizeInBits));
48274827
SrcEltBits.append(NumSrcElts - 1, APInt(SrcEltSizeInBits, 0));
48284828
return CastBitData(UndefSrcElts, SrcEltBits);
48294829
}

0 commit comments

Comments
 (0)