AMDGPU: Don't crash when trying to fold implicit operands

llvm-svn: 324550
This commit is contained in:
Matt Arsenault 2018-02-08 01:12:46 +00:00
parent 321b443ef6
commit c908e3f77a
2 changed files with 15 additions and 0 deletions

View File

@ -345,6 +345,7 @@ void SIFoldOperands::foldOperand(
// Don't fold into target independent nodes. Target independent opcodes
// don't have defined register classes.
if (UseDesc.isVariadic() ||
UseOp.isImplicit() ||
UseDesc.OpInfo[UseOpIdx].RegClass == -1)
return;
}

View File

@ -0,0 +1,14 @@
# RUN: llc -march=amdgcn -run-pass si-fold-operands -verify-machineinstrs -o - %s | FileCheck %s
---
# Make sure there is no crash when trying to fold an immediate into an
# implicit use
# CHECK: %0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
# CHECK-NEXT: S_ENDPGM implicit %0
name: fold_imm_implicit_operand
body: |
bb.0:
%0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
S_ENDPGM implicit %0
...