1 # RUN: llc -mtriple=amdgcn-- -run-pass=print-machine-uniformity -o - %s 2>&1 | FileCheck %s
4 # CHECK-LABEL: MachineUniformityInfo for function: temporal_diverge
8 tracksRegLiveness: true
11 - { id: 4, class: vgpr_32 }
12 - { id: 5, class: sgpr_32 }
13 - { id: 6, class: sgpr_32 }
15 - { reg: '$sgpr0_sgpr1', virtual-reg: '%3' }
16 - { reg: '$vgpr0', virtual-reg: '%4' }
17 - { reg: '$sgpr2', virtual-reg: '%5' }
18 - { reg: '$sgpr3', virtual-reg: '%6' }
23 %15:_(s64) = G_CONSTANT i64 0
26 successors: %bb.3, %bb.2
28 %11:_(s64) = G_PHI %12(s64), %bb.2, %15(s64), %bb.1
29 %18:_(s1) = G_CONSTANT i1 false
30 %12:sreg_64_xexec(s64) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.if.break), %18(s1), %11(s64)
31 ; CHECK: DIVERGENT: SI_LOOP
32 SI_LOOP %12(s64), %bb.2, implicit-def $exec, implicit-def $scc, implicit $exec
36 ; CHECK: DIVERGENT: %{{[0-9]+}}: %{{[0-9]+}}:_(s64) = G_PHI
37 %14:_(s64) = G_PHI %12(s64), %bb.2
38 G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.end.cf), %14(s64)
43 # CHECK-LABEL: MachineUniformityInfo for function: phi_at_exit
47 tracksRegLiveness: true
50 - { id: 4, class: vgpr_32 }
51 - { id: 5, class: sgpr_32 }
52 - { id: 6, class: sgpr_32 }
54 - { reg: '$sgpr0_sgpr1', virtual-reg: '%3' }
55 - { reg: '$vgpr0', virtual-reg: '%4' }
56 - { reg: '$sgpr2', virtual-reg: '%5' }
57 - { reg: '$sgpr3', virtual-reg: '%6' }
60 successors: %bb.2, %bb.3
63 %3:_(p4) = COPY $sgpr0_sgpr1
64 %7:_(p4) = COPY %3(p4)
65 %8:_(s64) = G_CONSTANT i64 40
66 %9:_(p4) = G_PTR_ADD %7, %8(s64)
67 %10:_(s32) = G_LOAD %9(p4) :: (load (s32), addrspace 4)
68 %11:_(s32) = G_CONSTANT i32 0
69 %12:_(s1) = G_ICMP intpred(sge), %10(s32), %11
70 G_BRCOND %12(s1), %bb.3
74 %24:_(s64) = G_CONSTANT i64 0
75 %14:_(s1) = G_CONSTANT i1 false
82 successors: %bb.5, %bb.4
84 %15:_(s64) = G_PHI %24(s64), %bb.2, %16(s64), %bb.4
85 %16:sreg_64_xexec(s64) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.if.break), %14(s1), %15(s64)
86 ; CHECK: DIVERGENT: SI_LOOP
87 SI_LOOP %16(s64), %bb.4, implicit-def $exec, implicit-def $scc, implicit $exec
91 ; CHECK: DIVERGENT: %{{[0-9]+}}: %{{[0-9]+}}:_(s64) = G_PHI
92 %18:_(s64) = G_PHI %16(s64), %bb.4
93 G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.end.cf), %18(s64)
101 # CHECK-LABEL: MachineUniformityInfo for function: phi_after_exit
105 tracksRegLiveness: true
107 - { id: 3, class: _ }
108 - { id: 4, class: vgpr_32 }
109 - { id: 5, class: sgpr_32 }
110 - { id: 6, class: sgpr_32 }
112 - { reg: '$sgpr0_sgpr1', virtual-reg: '%3' }
113 - { reg: '$vgpr0', virtual-reg: '%4' }
114 - { reg: '$sgpr2', virtual-reg: '%5' }
115 - { reg: '$sgpr3', virtual-reg: '%6' }
118 successors: %bb.2, %bb.3
119 liveins: $sgpr0_sgpr1
121 %3:_(p4) = COPY $sgpr0_sgpr1
122 %7:_(p4) = COPY %3(p4)
123 %8:_(s64) = G_CONSTANT i64 40
124 %9:_(p4) = G_PTR_ADD %7, %8(s64)
125 %10:_(s32) = G_LOAD %9(p4) :: (dereferenceable invariant load (s32), addrspace 4)
126 %11:_(s32) = G_CONSTANT i32 0
127 %12:_(s1) = G_ICMP intpred(sge), %10(s32), %11
128 G_BRCOND %12(s1), %bb.3
132 %24:_(s64) = G_CONSTANT i64 0
133 %14:_(s1) = G_CONSTANT i1 false
140 successors: %bb.5, %bb.4
142 %15:_(s64) = G_PHI %24(s64), %bb.2, %16(s64), %bb.4
143 %16:sreg_64_xexec(s64) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.if.break), %14(s1), %15(s64)
144 ; CHECK: DIVERGENT: SI_LOOP
145 SI_LOOP %16(s64), %bb.4, implicit-def $exec, implicit-def $scc, implicit $exec
149 ; CHECK: DIVERGENT: %{{[0-9]+}}: %{{[0-9]+}}:_(s64) = G_PHI
150 %18:_(s64) = G_PHI %16(s64), %bb.4
151 G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.end.cf), %18(s64)
159 # CHECK-LABEL: MachineUniformityInfo for function: temporal_diverge_inloop
160 name: temporal_diverge_inloop
163 tracksRegLiveness: true
165 - { id: 3, class: _ }
166 - { id: 4, class: vgpr_32 }
167 - { id: 5, class: sgpr_32 }
168 - { id: 6, class: sgpr_32 }
170 - { reg: '$sgpr0_sgpr1', virtual-reg: '%3' }
171 - { reg: '$vgpr0', virtual-reg: '%4' }
172 - { reg: '$sgpr2', virtual-reg: '%5' }
173 - { reg: '$sgpr3', virtual-reg: '%6' }
176 liveins: $sgpr0_sgpr1
178 %3:_(p4) = COPY $sgpr0_sgpr1
179 %7:_(p4) = COPY %3(p4)
180 %8:_(s64) = G_CONSTANT i64 40
181 %9:_(p4) = G_PTR_ADD %7, %8(s64)
182 %10:_(s32) = G_LOAD %9(p4) :: (dereferenceable invariant load (s32), addrspace 4)
183 %12:_(s32) = G_CONSTANT i32 0
184 %13:_(s1) = G_ICMP intpred(slt), %10(s32), %12
187 %25:_(s64) = G_CONSTANT i64 0
190 successors: %bb.4, %bb.3
192 %15:_(s64) = G_PHI %25(s64), %bb.2, %16(s64), %bb.3
193 %24:_(s1) = G_CONSTANT i1 false
194 %16:sreg_64_xexec(s64) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.if.break), %24(s1), %15(s64)
195 ; CHECK: DIVERGENT: SI_LOOP
196 SI_LOOP %16(s64), %bb.3, implicit-def $exec, implicit-def $scc, implicit $exec
200 ; CHECK: DIVERGENT: %{{[0-9]+}}: %{{[0-9]+}}:_(s64) = G_PHI
201 successors: %bb.5, %bb.2
203 %18:_(s64) = G_PHI %16(s64), %bb.3
204 G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.end.cf), %18(s64)
205 G_BRCOND %13(s1), %bb.2
213 # CHECK-LABEL: MachineUniformityInfo for function: temporal_uniform_indivloop
214 name: temporal_uniform_indivloop
217 tracksRegLiveness: true
219 - { id: 3, class: _ }
220 - { id: 4, class: vgpr_32 }
221 - { id: 5, class: sgpr_32 }
222 - { id: 6, class: sgpr_32 }
224 - { reg: '$sgpr0_sgpr1', virtual-reg: '%3' }
225 - { reg: '$vgpr0', virtual-reg: '%4' }
226 - { reg: '$sgpr2', virtual-reg: '%5' }
227 - { reg: '$sgpr3', virtual-reg: '%6' }
230 liveins: $sgpr0_sgpr1
232 %3:_(p4) = COPY $sgpr0_sgpr1
233 %19:_(s64) = G_CONSTANT i64 0
234 %7:_(p4) = COPY %3(p4)
235 %8:_(s64) = G_CONSTANT i64 40
236 %9:_(p4) = G_PTR_ADD %7, %8(s64)
237 %10:_(s32) = G_LOAD %9(p4) :: (dereferenceable invariant load (s32), addrspace 4)
238 %12:_(s32) = G_CONSTANT i32 0
239 %13:_(s1) = G_ICMP intpred(sge), %10(s32), %12
242 %15:_(s64) = G_PHI %16(s64), %bb.4, %19(s64), %bb.1
243 %24:_(s1) = G_CONSTANT i1 true
244 %16:sreg_64_xexec(s64) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.if.break), %24(s1), %15(s64)
247 successors: %bb.4, %bb.3
249 G_BRCOND %13(s1), %bb.3
253 successors: %bb.5, %bb.2
255 ; CHECK: DIVERGENT: SI_LOOP
256 SI_LOOP %16(s64), %bb.2, implicit-def $exec, implicit-def $scc, implicit $exec
260 ; CHECK: DIVERGENT: %{{[0-9]+}}: %{{[0-9]+}}:_(s64) = G_PHI
261 %18:_(s64) = G_PHI %16(s64), %bb.4
262 G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.end.cf), %18(s64)
267 # CHECK-LABEL: MachineUniformityInfo for function: temporal_diverge_loopuser
268 name: temporal_diverge_loopuser
271 tracksRegLiveness: true
273 - { id: 3, class: _ }
274 - { id: 4, class: vgpr_32 }
275 - { id: 5, class: sgpr_32 }
276 - { id: 6, class: sgpr_32 }
278 - { reg: '$sgpr0_sgpr1', virtual-reg: '%3' }
279 - { reg: '$vgpr0', virtual-reg: '%4' }
280 - { reg: '$sgpr2', virtual-reg: '%5' }
281 - { reg: '$sgpr3', virtual-reg: '%6' }
284 liveins: $sgpr0_sgpr1
286 %3:_(p4) = COPY $sgpr0_sgpr1
287 %19:_(s64) = G_CONSTANT i64 0
290 successors: %bb.3, %bb.2
292 %10:_(s64) = G_PHI %11(s64), %bb.2, %19(s64), %bb.1
293 %24:_(s1) = G_CONSTANT i1 false
294 %11:sreg_64_xexec(s64) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.if.break), %24(s1), %10(s64)
295 ; CHECK: DIVERGENT: SI_LOOP
296 SI_LOOP %11(s64), %bb.2, implicit-def $exec, implicit-def $scc, implicit $exec
300 ; CHECK: DIVERGENT: %{{[0-9]+}}: %{{[0-9]+}}:_(s64) = G_PHI
301 ; CHECK-NOT: DIVERGENT: %{{[0-9]+}}: %{{[0-9]+}}:_(s64) = G_PHI
302 %13:_(s64) = G_PHI %11(s64), %bb.2
303 G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.end.cf), %13(s64)
304 %14:_(p4) = COPY %3(p4)
305 %15:_(s64) = G_CONSTANT i64 40
306 %16:_(p4) = G_PTR_ADD %14, %15(s64)
307 %17:_(s32) = G_LOAD %16(p4) :: (dereferenceable invariant load (s32), addrspace 4)
308 %25:_(s32) = G_CONSTANT i32 0
309 %18:_(s1) = G_ICMP intpred(slt), %17(s32), %25
312 successors: %bb.5, %bb.4
314 G_BRCOND %18(s1), %bb.4
322 # CHECK-LABEL: MachineUniformityInfo for function: temporal_diverge_loopuser_nested
323 name: temporal_diverge_loopuser_nested
326 tracksRegLiveness: true
328 - { id: 3, class: _ }
329 - { id: 4, class: vgpr_32 }
330 - { id: 5, class: sgpr_32 }
331 - { id: 6, class: sgpr_32 }
333 - { reg: '$sgpr0_sgpr1', virtual-reg: '%3' }
334 - { reg: '$vgpr0', virtual-reg: '%4' }
335 - { reg: '$sgpr2', virtual-reg: '%5' }
336 - { reg: '$sgpr3', virtual-reg: '%6' }
339 liveins: $sgpr0_sgpr1
341 %3:_(p4) = COPY $sgpr0_sgpr1
342 %7:_(p4) = COPY %3(p4)
343 %8:_(s64) = G_CONSTANT i64 40
344 %9:_(p4) = G_PTR_ADD %7, %8(s64)
345 %10:_(s32) = G_LOAD %9(p4) :: (dereferenceable invariant load (s32), addrspace 4)
346 %12:_(s32) = G_CONSTANT i32 0
347 %13:_(s1) = G_ICMP intpred(sge), %10(s32), %12
350 %23:_(s64) = G_CONSTANT i64 0
353 successors: %bb.4, %bb.3
355 %15:_(s64) = G_PHI %23(s64), %bb.2, %16(s64), %bb.3
356 %25:_(s1) = G_CONSTANT i1 false
357 %16:sreg_64_xexec(s64) = G_INTRINSIC_CONVERGENT intrinsic(@llvm.amdgcn.if.break), %25(s1), %15(s64)
358 ; CHECK: DIVERGENT: SI_LOOP
359 SI_LOOP %16(s64), %bb.3, implicit-def $exec, implicit-def $scc, implicit $exec
363 ; CHECK: DIVERGENT: %{{[0-9]+}}: %{{[0-9]+}}:_(s64) = G_PHI
364 %18:_(s64) = G_PHI %16(s64), %bb.3
365 G_INTRINSIC_CONVERGENT_W_SIDE_EFFECTS intrinsic(@llvm.amdgcn.end.cf), %18(s64)
370 successors: %bb.8, %bb.5
372 G_BRCOND %13(s1), %bb.8
379 successors: %bb.7, %bb.2
381 %24:_(s1) = G_CONSTANT i1 false
382 G_BRCOND %24(s1), %bb.7