Skip to content

Commit c05cf1c

Browse files
committed
[AMDGPU] Use cast instead of dyn_cast
1 parent 6f7cd16 commit c05cf1c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

llvm/lib/Target/AMDGPU/R600ISelLowering.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,7 @@ static SDValue ReorganizeVector(SelectionDAG &DAG, SDValue VectorEntry,
17471747
for (unsigned i = 0; i < 4; i++) {
17481748
RemapSwizzle[i] = i;
17491749
if (NewBldVec[i].getOpcode() == ISD::EXTRACT_VECTOR_ELT) {
1750-
unsigned Idx = dyn_cast<ConstantSDNode>(NewBldVec[i].getOperand(1))
1750+
unsigned Idx = cast<ConstantSDNode>(NewBldVec[i].getOperand(1))
17511751
->getZExtValue();
17521752
if (i == Idx)
17531753
isUnmovable[Idx] = true;
@@ -1756,7 +1756,7 @@ static SDValue ReorganizeVector(SelectionDAG &DAG, SDValue VectorEntry,
17561756

17571757
for (unsigned i = 0; i < 4; i++) {
17581758
if (NewBldVec[i].getOpcode() == ISD::EXTRACT_VECTOR_ELT) {
1759-
unsigned Idx = dyn_cast<ConstantSDNode>(NewBldVec[i].getOperand(1))
1759+
unsigned Idx = cast<ConstantSDNode>(NewBldVec[i].getOperand(1))
17601760
->getZExtValue();
17611761
if (isUnmovable[Idx])
17621762
continue;
@@ -2160,7 +2160,7 @@ bool R600TargetLowering::FoldOperand(SDNode *ParentNode, unsigned SrcIdx,
21602160
uint64_t ImmValue = 0;
21612161

21622162
if (Src.getMachineOpcode() == R600::MOV_IMM_F32) {
2163-
ConstantFPSDNode *FPC = dyn_cast<ConstantFPSDNode>(Src.getOperand(0));
2163+
ConstantFPSDNode *FPC = cast<ConstantFPSDNode>(Src.getOperand(0));
21642164
float FloatValue = FPC->getValueAPF().convertToFloat();
21652165
if (FloatValue == 0.0) {
21662166
ImmReg = R600::ZERO;
@@ -2172,7 +2172,7 @@ bool R600TargetLowering::FoldOperand(SDNode *ParentNode, unsigned SrcIdx,
21722172
ImmValue = FPC->getValueAPF().bitcastToAPInt().getZExtValue();
21732173
}
21742174
} else {
2175-
ConstantSDNode *C = dyn_cast<ConstantSDNode>(Src.getOperand(0));
2175+
ConstantSDNode *C = cast<ConstantSDNode>(Src.getOperand(0));
21762176
uint64_t Value = C->getZExtValue();
21772177
if (Value == 0) {
21782178
ImmReg = R600::ZERO;
@@ -2189,8 +2189,7 @@ bool R600TargetLowering::FoldOperand(SDNode *ParentNode, unsigned SrcIdx,
21892189
if (ImmReg == R600::ALU_LITERAL_X) {
21902190
if (!Imm.getNode())
21912191
return false;
2192-
ConstantSDNode *C = dyn_cast<ConstantSDNode>(Imm);
2193-
assert(C);
2192+
ConstantSDNode *C = cast<ConstantSDNode>(Imm);
21942193
if (C->getZExtValue())
21952194
return false;
21962195
Imm = DAG.getTargetConstant(ImmValue, SDLoc(ParentNode), MVT::i32);

0 commit comments

Comments
 (0)