1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 -verify-machineinstrs -verify-coalescing -run-pass=simple-register-coalescing -o - %s | FileCheck %s
4 # The copy from %0 to %1 introduces liveness for %3.sub2. After
5 # coalescing, the use of %1.sub2 needs to be marked undef. The
6 # subregless copy previously did not consider the existing subregister
10 name: undef_subreg_use_after_full_copy_coalesce_0
11 tracksRegLiveness: true
14 ; CHECK-LABEL: name: undef_subreg_use_after_full_copy_coalesce_0
15 ; CHECK: undef %0.sub0:vreg_96 = V_MOV_B32_e32 0, implicit $exec
16 ; CHECK: dead %0.sub1:vreg_96 = V_MOV_B32_e32 0, implicit $exec
17 ; CHECK: S_ENDPGM 0, implicit undef %0.sub2
18 undef %0.sub0:vreg_96 = V_MOV_B32_e32 0, implicit $exec
19 %0.sub1:vreg_96 = V_MOV_B32_e32 0, implicit $exec
20 %1:vreg_96 = COPY killed %0
21 S_ENDPGM 0, implicit %1.sub2
25 # Same, except coalesced copy has a subregister index that needs to be
26 # composed with the use index.
28 name: undef_subreg_use_after_full_copy_coalesce_composed
29 tracksRegLiveness: true
32 ; CHECK-LABEL: name: undef_subreg_use_after_full_copy_coalesce_composed
33 ; CHECK: undef %0.sub0:vreg_128 = V_MOV_B32_e32 0, implicit $exec
34 ; CHECK: dead %0.sub1:vreg_128 = V_MOV_B32_e32 0, implicit $exec
35 ; CHECK: S_ENDPGM 0, implicit undef %2.sub1:vreg_64
36 undef %0.sub0:vreg_128 = V_MOV_B32_e32 0, implicit $exec
37 %0.sub1:vreg_128 = V_MOV_B32_e32 0, implicit $exec
38 %1:vreg_128 = COPY killed %0
39 %2:vreg_64 = COPY killed %1.sub2_sub3
40 S_ENDPGM 0, implicit %2.sub1
44 # FIXME: Initial computed range is wrong for %0.sub2_sub3 and fails
47 # name: undef_subreg_use_after_full_copy_coalesce_composed2
48 # tracksRegLiveness: true
51 # undef %0.sub0:vreg_128 = V_MOV_B32_e32 0, implicit $exec
52 # %0.sub1:vreg_128 = V_MOV_B32_e32 0, implicit $exec
53 # %1:vreg_128 = COPY killed %0.sub2_sub3
54 # S_ENDPGM 0, implicit %1.sub1
59 name: undef_subreg_use_after_full_copy_coalesce_1
60 tracksRegLiveness: true
63 liveins: $vgpr0, $vgpr1, $vgpr2
65 ; CHECK-LABEL: name: undef_subreg_use_after_full_copy_coalesce_1
66 ; CHECK: liveins: $vgpr0, $vgpr1, $vgpr2
67 ; CHECK: undef %2.sub0:vreg_96 = COPY $vgpr0
68 ; CHECK: %2.sub1:vreg_96 = COPY $vgpr1
69 ; CHECK: S_NOP 0, implicit undef %2.sub2
70 ; CHECK: S_NOP 0, implicit %2.sub1
72 %0:vgpr_32 = COPY killed $vgpr0
73 %1:vgpr_32 = COPY killed $vgpr1
74 undef %2.sub0:vreg_96 = COPY killed %0
75 %2.sub1:vreg_96 = COPY killed %1
76 %3:vreg_96 = COPY killed %2
77 S_NOP 0, implicit %3.sub2
78 S_NOP 0, implicit %3.sub1