1 ; RUN: opt < %s -disable-output -passes='print<cycles>' 2>&1 | FileCheck %s -check-prefix=CHECK
4 ; CHECK-LABEL: CycleInfo for function: empty
10 define void @simple() {
11 ; CHECK-LABEL: CycleInfo for function: simple
12 ; CHECK: depth=1: entries(loop)
17 br i1 undef, label %loop, label %exit
23 define void @two_latches() {
24 ; CHECK-LABEL: CycleInfo for function: two_latches
25 ; CHECK: depth=1: entries(loop) loop_next
30 br i1 undef, label %loop, label %loop_next
33 br i1 undef, label %exit, label %loop
39 define void @nested_simple() {
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 undef, label %inner, label %outer_latch
53 br i1 undef, label %outer_header, label %exit
59 define void @nested_outer_latch_in_inner_loop() {
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 undef, label %inner_latch, label %outer_header
73 br i1 undef, label %exit, label %inner_header
79 define void @sibling_loops() {
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 undef, label %left, label %right
87 br i1 undef, label %left, label %exit
90 br i1 undef, label %right, label %exit
96 define void @serial_loops() {
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 undef, label %first, label %second
107 br i1 undef, label %second, label %exit
113 define void @nested_sibling_loops() {
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 undef, 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() {
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 undef, label %middle_header, label %inner_latch
154 br i1 undef, label %inner_header, label %outer_latch
157 br i1 undef, label %outer_header, label %exit
163 define void @irreducible_basic() {
164 ; CHECK-LABEL: CycleInfo for function: irreducible_basic
165 ; CHECK: depth=1: entries(right left)
167 br i1 undef, label %left, label %right
170 br i1 undef, label %right, label %exit
173 br i1 undef, label %left, label %exit
179 define void @irreducible_mess() {
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 undef, label %A, label %B
188 br i1 undef, label %C, label %D
191 br i1 undef, 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() {
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 undef, label %E, label %exit
228 br i1 undef, label %A, label %exit
234 define void @irreducible_mountain_bug() {
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 undef, label %if.end, label %if.then
243 br i1 undef, label %if.then7, label %if.else
252 br i1 undef, label %while.cond.preheader, label %if.then39
254 while.cond.preheader:
258 br i1 undef, label %cond.true49, label %lor.rhs
261 br i1 undef, label %if.then69, label %while.body63
264 br i1 undef, label %exit, label %while.cond47
267 br i1 undef, label %cond.true49, label %cond.end61
270 br i1 undef, label %while.body63, label %while.cond
273 br i1 undef, label %exit, label %while.cond
276 br i1 undef, label %cond.end61, label %while.end76
282 br i1 undef, label %exit, label %if.end.i145
285 br i1 undef, label %exit, label %if.end8.i149
291 br i1 undef, label %exit, label %if.end.i
294 br i1 undef, label %exit, label %if.end8.i