Skip to content

Commit 8582d41

Browse files
[Target] Use SDValue::getConstantOperandVal (NFC)
1 parent 053c0ad commit 8582d41

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,7 +1474,7 @@ bool AMDGPUDAGToDAGISel::SelectMUBUFScratchOffen(SDNode *Parent,
14741474
// (add n0, c1)
14751475

14761476
SDValue N0 = Addr.getOperand(0);
1477-
SDValue N1 = Addr.getOperand(1);
1477+
uint64_t C1 = Addr.getConstantOperandVal(1);
14781478

14791479
// Offsets in vaddr must be positive if range checking is enabled.
14801480
//
@@ -1492,12 +1492,11 @@ bool AMDGPUDAGToDAGISel::SelectMUBUFScratchOffen(SDNode *Parent,
14921492
// MUBUF vaddr, but not on older subtargets which can only do this if the
14931493
// sign bit is known 0.
14941494
const SIInstrInfo *TII = Subtarget->getInstrInfo();
1495-
ConstantSDNode *C1 = cast<ConstantSDNode>(N1);
1496-
if (TII->isLegalMUBUFImmOffset(C1->getZExtValue()) &&
1495+
if (TII->isLegalMUBUFImmOffset(C1) &&
14971496
(!Subtarget->privateMemoryResourceIsRangeChecked() ||
14981497
CurDAG->SignBitIsZero(N0))) {
14991498
std::tie(VAddr, SOffset) = foldFrameIndex(N0);
1500-
ImmOffset = CurDAG->getTargetConstant(C1->getZExtValue(), DL, MVT::i32);
1499+
ImmOffset = CurDAG->getTargetConstant(C1, DL, MVT::i32);
15011500
return true;
15021501
}
15031502
}

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7686,10 +7686,10 @@ SDValue SITargetLowering::lowerImage(SDValue Op,
76867686
if (!BaseOpcode->Sampler) {
76877687
Unorm = True;
76887688
} else {
7689-
auto UnormConst =
7690-
cast<ConstantSDNode>(Op.getOperand(ArgOffset + Intr->UnormIndex));
7689+
uint64_t UnormConst =
7690+
Op.getConstantOperandVal(ArgOffset + Intr->UnormIndex);
76917691

7692-
Unorm = UnormConst->getZExtValue() ? True : False;
7692+
Unorm = UnormConst ? True : False;
76937693
}
76947694

76957695
SDValue TFE;

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25841,19 +25841,17 @@ SDValue X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
2584125841
assert(IntrData->Opc0 == X86ISD::VRNDSCALE && "Unexpected opcode");
2584225842
// Clear the upper bits of the rounding immediate so that the legacy
2584325843
// intrinsic can't trigger the scaling behavior of VRNDSCALE.
25844-
auto Round = cast<ConstantSDNode>(Op.getOperand(2));
25845-
SDValue RoundingMode =
25846-
DAG.getTargetConstant(Round->getZExtValue() & 0xf, dl, MVT::i32);
25844+
uint64_t Round = Op.getConstantOperandVal(2);
25845+
SDValue RoundingMode = DAG.getTargetConstant(Round & 0xf, dl, MVT::i32);
2584725846
return DAG.getNode(IntrData->Opc0, dl, Op.getValueType(),
2584825847
Op.getOperand(1), RoundingMode);
2584925848
}
2585025849
case ROUNDS: {
2585125850
assert(IntrData->Opc0 == X86ISD::VRNDSCALES && "Unexpected opcode");
2585225851
// Clear the upper bits of the rounding immediate so that the legacy
2585325852
// intrinsic can't trigger the scaling behavior of VRNDSCALE.
25854-
auto Round = cast<ConstantSDNode>(Op.getOperand(3));
25855-
SDValue RoundingMode =
25856-
DAG.getTargetConstant(Round->getZExtValue() & 0xf, dl, MVT::i32);
25853+
uint64_t Round = Op.getConstantOperandVal(3);
25854+
SDValue RoundingMode = DAG.getTargetConstant(Round & 0xf, dl, MVT::i32);
2585725855
return DAG.getNode(IntrData->Opc0, dl, Op.getValueType(),
2585825856
Op.getOperand(1), Op.getOperand(2), RoundingMode);
2585925857
}

0 commit comments

Comments
 (0)