1 ; RUN: opt < %s -cycles -analyze -enable-new-pm=0 | FileCheck %s -check-prefix=CHECK
2 ; RUN: opt < %s -disable-output -passes='print<cycles>' 2>&1 | FileCheck %s -check-prefix=CHECK
5 ; CHECK-LABEL: CycleInfo for function: empty
11 define void @simple() {
12 ; CHECK-LABEL: CycleInfo for function: simple
13 ; CHECK: depth=1: entries(loop)
18 br i1 undef, label %loop, label %exit
24 define void @two_latches() {
25 ; CHECK-LABEL: CycleInfo for function: two_latches
26 ; CHECK: depth=1: entries(loop) loop_next
31 br i1 undef, label %loop, label %loop_next
34 br i1 undef, label %exit, label %loop
40 define void @nested_simple() {
41 ; CHECK-LABEL: CycleInfo for function: nested_simple
42 ; CHECK: depth=1: entries(outer_header) outer_latch inner
43 ; CHECK: depth=2: entries(inner)
45 br label %outer_header
51 br i1 undef, label %inner, label %outer_latch
54 br i1 undef, label %outer_header, label %exit
60 define void @nested_outer_latch_in_inner_loop() {
61 ; CHECK-LABEL: CycleInfo for function: nested_outer_latch_in_inner_loop
62 ; CHECK: depth=1: entries(outer_header) inner_header inner_latch
63 ; CHECK: depth=2: entries(inner_header) inner_latch
65 br label %outer_header
68 br label %inner_header
71 br i1 undef, label %inner_latch, label %outer_header
74 br i1 undef, label %exit, label %inner_header
80 define void @sibling_loops() {
81 ; CHECK-LABEL: CycleInfo for function: sibling_loops
82 ; CHECK-DAG: depth=1: entries(left)
83 ; CHECK-DAG: depth=1: entries(right)
85 br i1 undef, label %left, label %right
88 br i1 undef, label %left, label %exit
91 br i1 undef, label %right, label %exit
97 define void @serial_loops() {
98 ; CHECK-LABEL: CycleInfo for function: serial_loops
99 ; CHECK-DAG: depth=1: entries(second)
100 ; CHECK-DAG: depth=1: entries(first)
105 br i1 undef, label %first, label %second
108 br i1 undef, label %second, label %exit
114 define void @nested_sibling_loops() {
115 ; CHECK-LABEL: CycleInfo for function: nested_sibling_loops
116 ; CHECK: depth=1: entries(outer_header) left right
117 ; CHECK-DAG: depth=2: entries(right)
118 ; CHECK-DAG: depth=2: entries(left)
120 br label %outer_header
123 br i1 undef, label %left, label %right
126 switch i32 undef, label %exit [ i32 0, label %left
127 i32 1, label %outer_header ]
130 switch i32 undef, label %outer_header [ i32 0, label %exit
131 i32 1, label %right ]
137 define void @deeper_nest() {
138 ; CHECK-LABEL: CycleInfo for function: deeper_nest
139 ; CHECK: depth=1: entries(outer_header) outer_latch middle_header inner_header inner_latch
140 ; CHECK: depth=2: entries(middle_header) inner_header inner_latch
141 ; CHECK: depth=3: entries(inner_header) inner_latch
143 br label %outer_header
146 br label %middle_header
149 br label %inner_header
152 br i1 undef, label %middle_header, label %inner_latch
155 br i1 undef, label %inner_header, label %outer_latch
158 br i1 undef, label %outer_header, label %exit
164 define void @irreducible_basic() {
165 ; CHECK-LABEL: CycleInfo for function: irreducible_basic
166 ; CHECK: depth=1: entries(right left)
168 br i1 undef, label %left, label %right
171 br i1 undef, label %right, label %exit
174 br i1 undef, label %left, label %exit
180 define void @irreducible_mess() {
181 ; CHECK-LABEL: CycleInfo for function: irreducible_mess
182 ; CHECK: depth=1: entries(B A) D C
183 ; CHECK: depth=2: entries(D C A)
184 ; CHECK: depth=3: entries(C A)
186 br i1 undef, label %A, label %B
189 br i1 undef, label %C, label %D
192 br i1 undef, label %C, label %D
195 switch i32 undef, label %A [ i32 0, label %D
199 switch i32 undef, label %B [ i32 0, label %C
206 define void @irreducible_into_simple_cycle() {
207 ; CHECK-LABEL: CycleInfo for function: irreducible_into_simple_cycle
208 ; CHECK: depth=1: entries(F C A) E D B
210 switch i32 undef, label %A [ i32 0, label %C
223 br i1 undef, label %E, label %exit
229 br i1 undef, label %A, label %exit
235 define void @irreducible_mountain_bug() {
236 ; CHECK-LABEL: CycleInfo for function: irreducible_mountain_bug
237 ; CHECK: depth=1: entries(while.cond)
238 ; CHECK: depth=2: entries(cond.end61 cond.true49) while.body63 while.cond47
239 ; CHECK: depth=3: entries(while.body63 cond.true49) while.cond47
241 br i1 undef, label %if.end, label %if.then
244 br i1 undef, label %if.then7, label %if.else
253 br i1 undef, label %while.cond.preheader, label %if.then39
255 while.cond.preheader:
259 br i1 undef, label %cond.true49, label %lor.rhs
262 br i1 undef, label %if.then69, label %while.body63
265 br i1 undef, label %exit, label %while.cond47
268 br i1 undef, label %cond.true49, label %cond.end61
271 br i1 undef, label %while.body63, label %while.cond
274 br i1 undef, label %exit, label %while.cond
277 br i1 undef, label %cond.end61, label %while.end76
283 br i1 undef, label %exit, label %if.end.i145
286 br i1 undef, label %exit, label %if.end8.i149
292 br i1 undef, label %exit, label %if.end.i
295 br i1 undef, label %exit, label %if.end8.i