Skip to content

Commit 99c7e3c

Browse files
committed
[AMDGPU] gfx1010 verifier changes
Differential Revision: https://reviews.llvm.org/D61521 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@360095 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 116060b commit 99c7e3c

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3192,16 +3192,24 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI,
31923192
}
31933193

31943194
if (isSOPK(MI)) {
3195-
int64_t Imm = getNamedOperand(MI, AMDGPU::OpName::simm16)->getImm();
3196-
if (sopkIsZext(MI)) {
3197-
if (!isUInt<16>(Imm)) {
3198-
ErrInfo = "invalid immediate for SOPK instruction";
3195+
auto Op = getNamedOperand(MI, AMDGPU::OpName::simm16);
3196+
if (Desc.isBranch()) {
3197+
if (!Op->isMBB()) {
3198+
ErrInfo = "invalid branch target for SOPK instruction";
31993199
return false;
32003200
}
32013201
} else {
3202-
if (!isInt<16>(Imm)) {
3203-
ErrInfo = "invalid immediate for SOPK instruction";
3204-
return false;
3202+
uint64_t Imm = Op->getImm();
3203+
if (sopkIsZext(MI)) {
3204+
if (!isUInt<16>(Imm)) {
3205+
ErrInfo = "invalid immediate for SOPK instruction";
3206+
return false;
3207+
}
3208+
} else {
3209+
if (!isInt<16>(Imm)) {
3210+
ErrInfo = "invalid immediate for SOPK instruction";
3211+
return false;
3212+
}
32053213
}
32063214
}
32073215
}

0 commit comments

Comments
 (0)