1 ; RUN: opt < %s -disable-output -passes='verify<cycles>,print<cycles>' 2>&1 | FileCheck %s -check-prefix=CHECK
4 ; CHECK-LABEL: CycleInfo for function: empty
10 define void @simple(i1 %arg) {
11 ; CHECK-LABEL: CycleInfo for function: simple
12 ; CHECK: depth=1: entries(loop)
17 br i1 %arg, label %loop, label %exit
23 define void @two_latches(i1 %arg) {
24 ; CHECK-LABEL: CycleInfo for function: two_latches
25 ; CHECK: depth=1: entries(loop) loop_next
30 br i1 %arg, label %loop, label %loop_next
33 br i1 %arg, label %exit, label %loop
39 define void @nested_simple(i1 %arg) {
40 ; CHECK-LABEL: CycleInfo for function: nested_simple
41 ; CHECK: depth=1: entries(outer_header) outer_latch inner
42 ; CHECK: depth=2: entries(inner)
44 br label %outer_header
50 br i1 %arg, label %inner, label %outer_latch
53 br i1 %arg, label %outer_header, label %exit
59 define void @nested_outer_latch_in_inner_loop(i1 %arg) {
60 ; CHECK-LABEL: CycleInfo for function: nested_outer_latch_in_inner_loop
61 ; CHECK: depth=1: entries(outer_header) inner_header inner_latch
62 ; CHECK: depth=2: entries(inner_header) inner_latch
64 br label %outer_header
67 br label %inner_header
70 br i1 %arg, label %inner_latch, label %outer_header
73 br i1 %arg, label %exit, label %inner_header
79 define void @sibling_loops(i1 %arg) {
80 ; CHECK-LABEL: CycleInfo for function: sibling_loops
81 ; CHECK-DAG: depth=1: entries(left)
82 ; CHECK-DAG: depth=1: entries(right)
84 br i1 %arg, label %left, label %right
87 br i1 %arg, label %left, label %exit
90 br i1 %arg, label %right, label %exit
96 define void @serial_loops(i1 %arg) {
97 ; CHECK-LABEL: CycleInfo for function: serial_loops
98 ; CHECK-DAG: depth=1: entries(second)
99 ; CHECK-DAG: depth=1: entries(first)
104 br i1 %arg, label %first, label %second
107 br i1 %arg, label %second, label %exit
113 define void @nested_sibling_loops(i1 %arg) {
114 ; CHECK-LABEL: CycleInfo for function: nested_sibling_loops
115 ; CHECK: depth=1: entries(outer_header) left right
116 ; CHECK-DAG: depth=2: entries(right)
117 ; CHECK-DAG: depth=2: entries(left)
119 br label %outer_header
122 br i1 %arg, label %left, label %right
125 switch i32 undef, label %exit [ i32 0, label %left
126 i32 1, label %outer_header ]
129 switch i32 undef, label %outer_header [ i32 0, label %exit
130 i32 1, label %right ]
136 define void @deeper_nest(i1 %arg) {
137 ; CHECK-LABEL: CycleInfo for function: deeper_nest
138 ; CHECK: depth=1: entries(outer_header) outer_latch middle_header inner_header inner_latch
139 ; CHECK: depth=2: entries(middle_header) inner_header inner_latch
140 ; CHECK: depth=3: entries(inner_header) inner_latch
142 br label %outer_header
145 br label %middle_header
148 br label %inner_header
151 br i1 %arg, label %middle_header, label %inner_latch
154 br i1 %arg, label %inner_header, label %outer_latch
157 br i1 %arg, label %outer_header, label %exit
163 define void @irreducible_basic(i1 %arg) {
164 ; CHECK-LABEL: CycleInfo for function: irreducible_basic
165 ; CHECK: depth=1: entries(right left)
167 br i1 %arg, label %left, label %right
170 br i1 %arg, label %right, label %exit
173 br i1 %arg, label %left, label %exit
179 define void @irreducible_mess(i1 %arg) {
180 ; CHECK-LABEL: CycleInfo for function: irreducible_mess
181 ; CHECK: depth=1: entries(B A) D C
182 ; CHECK: depth=2: entries(D C A)
183 ; CHECK: depth=3: entries(C A)
185 br i1 %arg, label %A, label %B
188 br i1 %arg, label %C, label %D
191 br i1 %arg, label %C, label %D
194 switch i32 undef, label %A [ i32 0, label %D
198 switch i32 undef, label %B [ i32 0, label %C
205 define void @irreducible_into_simple_cycle(i1 %arg) {
206 ; CHECK-LABEL: CycleInfo for function: irreducible_into_simple_cycle
207 ; CHECK: depth=1: entries(F C A) E D B
209 switch i32 undef, label %A [ i32 0, label %C
222 br i1 %arg, label %E, label %exit
228 br i1 %arg, label %A, label %exit
234 define void @irreducible_mountain_bug(i1 %arg) {
235 ; CHECK-LABEL: CycleInfo for function: irreducible_mountain_bug
236 ; CHECK: depth=1: entries(while.cond)
237 ; CHECK: depth=2: entries(cond.end61 cond.true49) while.body63 while.cond47
238 ; CHECK: depth=3: entries(while.body63 cond.true49) while.cond47
240 br i1 %arg, label %if.end, label %if.then
243 br i1 %arg, label %if.then7, label %if.else
252 br i1 %arg, label %while.cond.preheader, label %if.then39
254 while.cond.preheader:
258 br i1 %arg, label %cond.true49, label %lor.rhs
261 br i1 %arg, label %if.then69, label %while.body63
264 br i1 %arg, label %exit, label %while.cond47
267 br i1 %arg, label %cond.true49, label %cond.end61
270 br i1 %arg, label %while.body63, label %while.cond
273 br i1 %arg, label %exit, label %while.cond
276 br i1 %arg, label %cond.end61, label %while.end76
282 br i1 %arg, label %exit, label %if.end.i145
285 br i1 %arg, label %exit, label %if.end8.i149
291 br i1 %arg, label %exit, label %if.end.i
294 br i1 %arg, label %exit, label %if.end8.i