1 # RUN: llc -march=amdgcn -mcpu=gfx1100 -run-pass=si-optimize-exec-masking-pre-ra,greedy -verify-machineinstrs -o - %s
3 # This sample can trigger a "Non-empty but used interval" assert in regalloc if
4 # SIOptimizeExecMaskingPreRA does not update live intervals correctly.
8 tracksRegLiveness: true
11 %0:sreg_32 = IMPLICIT_DEF
12 %1:sreg_32_xm0_xexec = IMPLICIT_DEF
13 %2:sreg_64_xexec = IMPLICIT_DEF
14 %3:sgpr_32 = IMPLICIT_DEF
15 %4:sreg_32_xexec_hi = IMPLICIT_DEF
16 %5:sreg_32 = IMPLICIT_DEF
17 %6:sreg_32 = IMPLICIT_DEF
18 %7:sreg_32 = IMPLICIT_DEF
19 %8:sreg_32 = IMPLICIT_DEF
20 %9:sreg_32 = IMPLICIT_DEF
21 %10:sreg_32 = IMPLICIT_DEF
22 %11:sreg_32 = IMPLICIT_DEF
23 %12:sreg_64_xexec = IMPLICIT_DEF
24 %13:sreg_64_xexec = IMPLICIT_DEF
25 %14:sreg_32 = IMPLICIT_DEF
26 %15:sreg_32 = IMPLICIT_DEF
27 %16:sreg_32 = IMPLICIT_DEF
28 %17:sreg_32 = IMPLICIT_DEF
29 %18:sgpr_32 = IMPLICIT_DEF
30 $exec_lo = S_MOV_B32_term undef %9
34 $exec_lo = S_XOR_B32_term $exec_lo, undef %10, implicit-def $scc
35 S_CBRANCH_EXECZ %bb.39, implicit $exec
39 S_CMP_EQ_U32 %15, undef %15, implicit-def $scc
40 %19:sreg_32_xm0_xexec = S_CSELECT_B32 -1, 0, implicit killed undef $scc
41 %20:sreg_32 = IMPLICIT_DEF
42 dead $vcc_lo = COPY undef %20
43 S_CBRANCH_VCCNZ %bb.3, implicit $vcc
47 dead $vcc_lo = S_AND_B32 $exec_lo, undef %19, implicit-def dead $scc
48 S_CBRANCH_VCCNZ %bb.6, implicit $vcc
52 %21:vgpr_32 = V_CNDMASK_B32_e64 0, 0, 0, 1, %19, implicit $exec
53 %22:sreg_32_xm0_xexec = V_CMP_NE_U32_e64 1, undef %21, implicit $exec
54 dead $vcc_lo = S_AND_B32 $exec_lo, undef %22, implicit-def dead $scc
55 S_CBRANCH_VCCNZ %bb.7, implicit $vcc
63 %18:sgpr_32 = COPY %18
64 S_CBRANCH_VCCNZ %bb.1, implicit killed $vcc
68 %23:sreg_32 = S_AND_B32 undef %20, %9, implicit-def dead $scc
69 $exec_lo = S_MOV_B32_term undef %23
70 S_CBRANCH_EXECZ %bb.10, implicit $exec
74 %24:vgpr_32 = GLOBAL_LOAD_DWORD_SADDR %13, undef %21, 0, 0, implicit $exec
81 $exec_lo = S_XOR_B32_term $exec_lo, %23, implicit-def $scc
82 S_CBRANCH_EXECZ %bb.31, implicit $exec
86 %25:vgpr_32 = GLOBAL_LOAD_DWORD_SADDR %2, undef %21, 0, 0, implicit $exec
87 $exec_lo = S_MOV_B32_term undef %23
88 S_CBRANCH_EXECZ %bb.12, implicit $exec
92 $exec_lo = S_XOR_B32_term $exec_lo, undef %23, implicit-def $scc
93 S_CBRANCH_EXECZ %bb.15, implicit $exec
97 $exec_lo = S_MOV_B32_term undef %23
98 S_CBRANCH_EXECZ %bb.15, implicit $exec
102 %26:vgpr_32 = V_BFI_B32_e64 2147483647, %3, undef %25, implicit $exec
103 %27:vgpr_32 = V_CNDMASK_B32_e64 0, undef %26, 0, 2143289344, %1, implicit $exec
104 dead %28:vgpr_32, %29:sreg_32_xm0_xexec = V_ADD_CO_U32_e64 %12.sub0, undef %27, 0, implicit $exec
105 %30:vgpr_32, dead %31:sreg_32_xm0_xexec = V_ADDC_U32_e64 %12.sub1, undef %27, undef %22, 0, implicit $exec
106 SCRATCH_STORE_DWORD_SADDR undef %27, %4, 0, 0, implicit $exec, implicit $flat_scr
110 %32:sreg_32 = IMPLICIT_DEF
111 $exec_lo = S_MOV_B32_term undef %32
112 S_CBRANCH_EXECZ %bb.17, implicit $exec
116 %33:sreg_32 = S_AND_B32 undef %32, %16, implicit-def dead $scc
117 $exec_lo = S_MOV_B32_term undef %33
118 S_CBRANCH_EXECZ %bb.17, implicit $exec
122 $exec_lo = S_XOR_B32_term $exec_lo, undef %32, implicit-def $scc
123 S_CBRANCH_EXECZ %bb.30, implicit $exec
127 %34:sreg_32 = IMPLICIT_DEF
128 %35:sreg_32 = S_AND_B32 undef %34, %17, implicit-def dead $scc
129 $exec_lo = S_MOV_B32_term undef %35
130 S_CBRANCH_EXECZ %bb.20, implicit $exec
134 dead %36:vgpr_32, $sgpr_null = V_ADD_CO_U32_e64 %14, undef %25, 0, implicit $exec
135 %37:sreg_32 = IMPLICIT_DEF
139 $exec_lo = S_OR_B32 $exec_lo, %34, implicit-def $scc
143 %38:sreg_32 = IMPLICIT_DEF
144 $exec_lo = S_MOV_B32_term undef %38
145 S_CBRANCH_EXECZ %bb.23, implicit $exec
155 %39:sreg_32 = S_AND_B32 undef %38, %11, implicit-def dead $scc
156 $exec_lo = S_MOV_B32_term undef %39
157 S_CBRANCH_EXECZ %bb.38, implicit $exec
161 %40:sreg_32 = S_AND_B32 %5, $exec_lo, implicit-def dead $scc
165 %37:sreg_32 = S_OR_B32 %38, %37, implicit-def $scc
166 $exec_lo = S_ANDN2_B32_term $exec_lo, undef %37, implicit-def $scc
167 S_CBRANCH_EXECNZ %bb.21, implicit $exec
171 %41:sreg_32 = S_OR_B32 undef %37, %35, implicit-def $scc
172 $exec_lo = S_ANDN2_B32_term $exec_lo, undef %35, implicit-def $scc
173 S_CBRANCH_EXECNZ %bb.21, implicit $exec
177 dead $vcc_lo = S_AND_B32 $exec_lo, %22, implicit-def dead $scc
178 S_CBRANCH_VCCNZ %bb.29, implicit $vcc
182 $exec_lo = S_ANDN2_B32_term $exec_lo, undef %23, implicit-def $scc
183 S_CBRANCH_EXECNZ %bb.28, implicit $exec
187 $exec_lo = S_OR_B32 $exec_lo, %32, implicit-def $scc
191 %42:sreg_32_xm0_xexec = V_CMP_NE_U32_e64 undef %23, %21, implicit $exec
192 $vcc_lo = S_AND_B32 $exec_lo, undef %42, implicit-def dead $scc
193 S_CBRANCH_VCCZ %bb.6, implicit killed $vcc
196 %43:sreg_32 = S_AND_B32 %10, %8, implicit-def dead $scc
197 $exec_lo = S_MOV_B32_term undef %43
198 S_CBRANCH_EXECZ %bb.37, implicit $exec
202 %44:sreg_32 = S_AND_B32 undef %43, %0, implicit-def dead $scc
203 $exec_lo = S_MOV_B32_term undef %44
204 S_CBRANCH_EXECZ %bb.37, implicit $exec
208 %45:sreg_32 = S_AND_B32 undef %44, %6, implicit-def dead $scc
209 $exec_lo = S_MOV_B32_term undef %45
210 S_CBRANCH_EXECZ %bb.37, implicit $exec
214 %46:sreg_32 = S_AND_B32 undef %45, %7, implicit-def dead $scc
215 $exec_lo = S_MOV_B32_term undef %46
216 S_CBRANCH_EXECZ %bb.36, implicit $exec
223 dead $vcc_lo = COPY undef %47:sreg_32