1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -march=amdgcn -mcpu=gfx900 -o - -verify-coalescing -run-pass=register-coalescer %s | FileCheck -check-prefix=GCN %s
5 # Do not rematerialize V_MOV_B32 at COPY because source register %1 is killed.
7 name: no_remat_killed_src_in_inst
8 tracksRegLiveness: true
13 ; GCN-LABEL: name: no_remat_killed_src_in_inst
14 ; GCN: liveins: $vgpr0
16 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
17 ; GCN-NEXT: [[V_ADD_U32_e32_:%[0-9]+]]:vgpr_32 = V_ADD_U32_e32 1, [[COPY]], implicit $exec
18 ; GCN-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 [[V_ADD_U32_e32_]], implicit $exec
19 ; GCN-NEXT: $vgpr0 = COPY [[V_MOV_B32_e32_]]
20 ; GCN-NEXT: SI_RETURN_TO_EPILOG $vgpr0
21 %0:vgpr_32 = COPY $vgpr0
22 %1:vgpr_32 = V_ADD_U32_e32 1, %0, implicit $exec
23 %2:vgpr_32 = V_MOV_B32_e32 killed %1, implicit $exec
24 $vgpr0 = COPY killed %2
25 SI_RETURN_TO_EPILOG killed $vgpr0
28 # Do not rematerialize V_MOV_B32 at COPY because source register %1 is killed
29 # after the MOV but before the COPY.
31 name: no_remat_killed_src_after_inst
32 tracksRegLiveness: true
37 ; GCN-LABEL: name: no_remat_killed_src_after_inst
38 ; GCN: liveins: $vgpr0
40 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
41 ; GCN-NEXT: [[V_ADD_U32_e32_:%[0-9]+]]:vgpr_32 = V_ADD_U32_e32 1, [[COPY]], implicit $exec
42 ; GCN-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 [[V_ADD_U32_e32_]], implicit $exec
43 ; GCN-NEXT: KILL [[V_ADD_U32_e32_]]
44 ; GCN-NEXT: $vgpr0 = COPY [[V_MOV_B32_e32_]]
45 ; GCN-NEXT: SI_RETURN_TO_EPILOG $vgpr0
46 %0:vgpr_32 = COPY $vgpr0
47 %1:vgpr_32 = V_ADD_U32_e32 1, %0, implicit $exec
48 %2:vgpr_32 = V_MOV_B32_e32 %1, implicit $exec
50 $vgpr0 = COPY killed %2
51 SI_RETURN_TO_EPILOG killed $vgpr0
54 # Even if %1 is not killed do not rematerialize V_MOV_B32 so that we do not
55 # extend %1 liverange.
57 name: no_remat_alive_src_in_inst_unused
58 tracksRegLiveness: true
63 ; GCN-LABEL: name: no_remat_alive_src_in_inst_unused
64 ; GCN: liveins: $vgpr0
66 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
67 ; GCN-NEXT: [[V_ADD_U32_e32_:%[0-9]+]]:vgpr_32 = V_ADD_U32_e32 1, [[COPY]], implicit $exec
68 ; GCN-NEXT: [[V_MOV_B32_e32_:%[0-9]+]]:vgpr_32 = V_MOV_B32_e32 [[V_ADD_U32_e32_]], implicit $exec
69 ; GCN-NEXT: $vgpr0 = COPY [[V_MOV_B32_e32_]]
70 ; GCN-NEXT: SI_RETURN_TO_EPILOG $vgpr0
71 %0:vgpr_32 = COPY $vgpr0
72 %1:vgpr_32 = V_ADD_U32_e32 1, %0, implicit $exec
73 %2:vgpr_32 = V_MOV_B32_e32 %1, implicit $exec
74 $vgpr0 = COPY killed %2
75 SI_RETURN_TO_EPILOG killed $vgpr0
78 # Rematerialize V_MOV_B32 since %1 is available at COPY and still alive.
80 name: remat_alive_src_in_inst_used_and_available
81 tracksRegLiveness: true
86 ; GCN-LABEL: name: remat_alive_src_in_inst_used_and_available
87 ; GCN: liveins: $vgpr0
89 ; GCN-NEXT: [[COPY:%[0-9]+]]:vgpr_32 = COPY $vgpr0
90 ; GCN-NEXT: [[V_ADD_U32_e32_:%[0-9]+]]:vgpr_32 = V_ADD_U32_e32 1, [[COPY]], implicit $exec
91 ; GCN-NEXT: $vgpr0 = V_MOV_B32_e32 [[V_ADD_U32_e32_]], implicit $exec
92 ; GCN-NEXT: SI_RETURN_TO_EPILOG $vgpr0
93 %0:vgpr_32 = COPY $vgpr0
94 %1:vgpr_32 = V_ADD_U32_e32 1, %0, implicit $exec
95 %2:vgpr_32 = V_MOV_B32_e32 %1, implicit $exec
96 $vgpr0 = COPY killed %2
97 SI_RETURN_TO_EPILOG killed $vgpr0, implicit %1