Skip to content

Commit

Permalink
[Target] Use getConstantOperand (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Jan 29, 2024
1 parent 1f5934a commit ae46855
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
3 changes: 1 addition & 2 deletions llvm/lib/Target/AMDGPU/SIISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7726,8 +7726,7 @@ SDValue SITargetLowering::lowerImage(SDValue Op,
}
}

unsigned CPol = cast<ConstantSDNode>(
Op.getOperand(ArgOffset + Intr->CachePolicyIndex))->getZExtValue();
unsigned CPol = Op.getConstantOperandVal(ArgOffset + Intr->CachePolicyIndex);
if (BaseOpcode->Atomic)
CPol |= AMDGPU::CPol::GLC; // TODO no-return optimization
if (CPol & ~((IsGFX12Plus ? AMDGPU::CPol::ALL : AMDGPU::CPol::ALL_pregfx12) |
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/ARM/ARMISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4068,9 +4068,7 @@ SDValue ARMTargetLowering::LowerEH_SJLJ_SETUP_DISPATCH(SDValue Op,
SDValue ARMTargetLowering::LowerINTRINSIC_VOID(
SDValue Op, SelectionDAG &DAG, const ARMSubtarget *Subtarget) const {
unsigned IntNo =
cast<ConstantSDNode>(
Op.getOperand(Op.getOperand(0).getValueType() == MVT::Other))
->getZExtValue();
Op.getConstantOperandVal(Op.getOperand(0).getValueType() == MVT::Other);
switch (IntNo) {
default:
return SDValue(); // Don't custom lower most intrinsics.
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/PowerPC/PPCISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11253,9 +11253,9 @@ SDValue PPCTargetLowering::LowerIS_FPCLASS(SDValue Op,
SelectionDAG &DAG) const {
assert(Subtarget.hasP9Vector() && "Test data class requires Power9");
SDValue LHS = Op.getOperand(0);
const auto *RHS = cast<ConstantSDNode>(Op.getOperand(1));
uint64_t RHSC = Op.getConstantOperandVal(1);
SDLoc Dl(Op);
FPClassTest Category = static_cast<FPClassTest>(RHS->getZExtValue());
FPClassTest Category = static_cast<FPClassTest>(RHSC);
return getDataClassTest(LHS, Category, Dl, DAG, Subtarget);
}

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,7 @@ void RISCVDAGToDAGISel::selectSF_VC_X_SE(SDNode *Node) {
"Unexpected vsetvli intrinsic");

// imm, imm, imm, simm5/scalar, sew, log2lmul, vl
auto *SewSDNode = cast<ConstantSDNode>(Node->getOperand(6));
unsigned Log2SEW = Log2_32(SewSDNode->getZExtValue());
unsigned Log2SEW = Log2_32(Node->getConstantOperandVal(6));
SDValue SEWOp =
CurDAG->getTargetConstant(Log2SEW, DL, Subtarget->getXLenVT());
SmallVector<SDValue, 8> Operands = {Node->getOperand(2), Node->getOperand(3),
Expand Down

0 comments on commit ae46855

Please sign in to comment.