Skip to content

Commit aa0b0fb

Browse files
committed
[WebAssembly] Use SDValue::getConstantOperandVal (NFC)
Reviewed By: tlively Differential Revision: https://reviews.llvm.org/D107499
1 parent 12b34e0 commit aa0b0fb

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

llvm/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ void WebAssemblyDAGToDAGISel::Select(SDNode *Node) {
117117
if (!MF.getSubtarget<WebAssemblySubtarget>().hasAtomics())
118118
break;
119119

120-
uint64_t SyncScopeID =
121-
cast<ConstantSDNode>(Node->getOperand(2).getNode())->getZExtValue();
120+
uint64_t SyncScopeID = Node->getConstantOperandVal(2);
122121
MachineSDNode *Fence = nullptr;
123122
switch (SyncScopeID) {
124123
case SyncScope::SingleThread:
@@ -152,7 +151,7 @@ void WebAssemblyDAGToDAGISel::Select(SDNode *Node) {
152151
}
153152

154153
case ISD::INTRINSIC_WO_CHAIN: {
155-
unsigned IntNo = cast<ConstantSDNode>(Node->getOperand(0))->getZExtValue();
154+
unsigned IntNo = Node->getConstantOperandVal(0);
156155
switch (IntNo) {
157156
case Intrinsic::wasm_tls_size: {
158157
MachineSDNode *TLSSize = CurDAG->getMachineNode(
@@ -174,7 +173,7 @@ void WebAssemblyDAGToDAGISel::Select(SDNode *Node) {
174173
}
175174

176175
case ISD::INTRINSIC_W_CHAIN: {
177-
unsigned IntNo = cast<ConstantSDNode>(Node->getOperand(1))->getZExtValue();
176+
unsigned IntNo = Node->getConstantOperandVal(1);
178177
const auto &TLI = CurDAG->getTargetLoweringInfo();
179178
MVT PtrVT = TLI.getPointerTy(CurDAG->getDataLayout());
180179
switch (IntNo) {

llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ void WebAssemblyTargetLowering::computeKnownBitsForTargetNode(
830830
default:
831831
break;
832832
case ISD::INTRINSIC_WO_CHAIN: {
833-
unsigned IntNo = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
833+
unsigned IntNo = Op.getConstantOperandVal(0);
834834
switch (IntNo) {
835835
default:
836836
break;
@@ -1492,7 +1492,7 @@ SDValue WebAssemblyTargetLowering::LowerRETURNADDR(SDValue Op,
14921492
if (verifyReturnAddressArgumentIsConstant(Op, DAG))
14931493
return SDValue();
14941494

1495-
unsigned Depth = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
1495+
unsigned Depth = Op.getConstantOperandVal(0);
14961496
MakeLibCallOptions CallOptions;
14971497
return makeLibCall(DAG, RTLIB::RETURN_ADDRESS, Op.getValueType(),
14981498
{DAG.getConstant(Depth, DL, MVT::i32)}, CallOptions, DL)
@@ -1671,10 +1671,10 @@ SDValue WebAssemblyTargetLowering::LowerIntrinsic(SDValue Op,
16711671
switch (Op.getOpcode()) {
16721672
case ISD::INTRINSIC_VOID:
16731673
case ISD::INTRINSIC_W_CHAIN:
1674-
IntNo = cast<ConstantSDNode>(Op.getOperand(1))->getZExtValue();
1674+
IntNo = Op.getConstantOperandVal(1);
16751675
break;
16761676
case ISD::INTRINSIC_WO_CHAIN:
1677-
IntNo = cast<ConstantSDNode>(Op.getOperand(0))->getZExtValue();
1677+
IntNo = Op.getConstantOperandVal(0);
16781678
break;
16791679
default:
16801680
llvm_unreachable("Invalid intrinsic");

0 commit comments

Comments
 (0)