forked from OSchip/llvm-project
AMDGPU: Fix crash with undef vreg input operand
llvm-svn: 305814
This commit is contained in:
parent
e7a35539c5
commit
7f67b35901
|
@ -470,7 +470,7 @@ static MachineOperand *getImmOrMaterializedImm(MachineRegisterInfo &MRI,
|
|||
return &Op;
|
||||
|
||||
MachineInstr *Def = MRI.getVRegDef(Op.getReg());
|
||||
if (Def->isMoveImmediate()) {
|
||||
if (Def && Def->isMoveImmediate()) {
|
||||
MachineOperand &ImmSrc = Def->getOperand(1);
|
||||
if (ImmSrc.isImm())
|
||||
return &ImmSrc;
|
||||
|
|
|
@ -68,6 +68,10 @@
|
|||
ret void
|
||||
}
|
||||
|
||||
define amdgpu_kernel void @undefined_vreg_operand() {
|
||||
unreachable
|
||||
}
|
||||
|
||||
declare i32 @llvm.amdgcn.workitem.id.x() #1
|
||||
|
||||
attributes #0 = { nounwind }
|
||||
|
@ -856,3 +860,20 @@ body: |
|
|||
S_ENDPGM
|
||||
|
||||
...
|
||||
---
|
||||
# There is only an undef use operand for %1, so there is no
|
||||
# corresponding defining instruction
|
||||
|
||||
name: undefined_vreg_operand
|
||||
tracksRegLiveness: true
|
||||
registers:
|
||||
- { id: 0, class: vgpr_32, preferred-register: '' }
|
||||
- { id: 1, class: vgpr_32, preferred-register: '' }
|
||||
- { id: 2, class: vgpr_32, preferred-register: '' }
|
||||
body: |
|
||||
bb.0:
|
||||
%0 = V_MOV_B32_e32 0, implicit %exec
|
||||
%2 = V_XOR_B32_e64 killed %0, undef %1, implicit %exec
|
||||
S_ENDPGM
|
||||
|
||||
...
|
||||
|
|
Loading…
Reference in New Issue