# REQUIRES: amdgpu-registered-target
# RUN: llvm-reduce -abort-on-invalid-reduction -simplify-mir --delta-passes=instructions -mtriple=amdgcn-amd-amdhsa --test FileCheck --test-arg --check-prefix=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t 2> %t.log
# RUN: FileCheck --check-prefix=RESULT %s < %t
# CHECK-INTERESTINGNESS-LABEL: name: dead_def
# CHECK-INTERESTINGNESS: S_ENDPGM
# Make sure no IMPLICIT_DEF is introduced for dead operands.
# RESULT: bb.0
# RESULT-NEXT: S_ENDPGM
---
name: dead_def
tracksRegLiveness: true
body: |
bb.0:
S_WAITCNT 0
dead %0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
S_ENDPGM 0
...
# CHECK-INTERESTINGNESS-LABEL: name: prev_def_rc_is_dead
# CHECK-INTERESTINGNESS: V_MOV_B32_e32
# CHECK-INTERESTINGNESS: V_MOV_B32_e32
# CHECK-INTERESTINGNESS: V_MOV_B32_e32
# RESULT: %0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
# RESULT-NEXT: dead %1:vgpr_32 = V_MOV_B32_e32 %0, implicit $exec
# RESULT-NEXT: %2:vgpr_32 = V_MOV_B32_e32 %0, implicit $exec
---
name: prev_def_rc_is_dead
tracksRegLiveness: true
body: |
bb.0:
S_WAITCNT 0
%0:vgpr_32 = V_MOV_B32_e32 0, implicit $exec
dead %1:vgpr_32 = V_MOV_B32_e32 %0, implicit $exec
%2:vgpr_32 = V_MOV_B32_e32 %0, implicit $exec
S_ENDPGM 0, implicit %2
...