1 ; RUN: opt < %s -analyze -block-freq -enable-new-pm=0 | FileCheck %s
2 ; RUN: opt < %s -passes='print<block-freq>' -disable-output 2>&1 | FileCheck %s
4 ; CHECK-LABEL: Printing analysis {{.*}} for function 'nested_loop_with_branches'
5 ; CHECK-NEXT: block-frequency-info: nested_loop_with_branches
6 define void @nested_loop_with_branches(i32 %a) {
7 ; CHECK-NEXT: entry: float = 1.0, int = [[ENTRY:[0-9]+]]
9 %v0 = call i1 @foo0(i32 %a)
10 br i1 %v0, label %exit, label %outer, !prof !0
12 ; CHECK-NEXT: outer: float = 12.0,
14 %i = phi i32 [ 0, %entry ], [ %i.next, %inner.end ], [ %i.next, %no_inner ]
15 %i.next = add i32 %i, 1
16 %do_inner = call i1 @foo1(i32 %i)
17 br i1 %do_inner, label %no_inner, label %inner, !prof !0
19 ; CHECK-NEXT: inner: float = 36.0,
21 %j = phi i32 [ 0, %outer ], [ %j.next, %inner.end ]
22 %side = call i1 @foo3(i32 %j)
23 br i1 %side, label %left, label %right, !prof !0
25 ; CHECK-NEXT: left: float = 9.0,
27 %v4 = call i1 @foo4(i32 %j)
30 ; CHECK-NEXT: right: float = 27.0,
32 %v5 = call i1 @foo5(i32 %j)
35 ; CHECK-NEXT: inner.end: float = 36.0,
37 %stay_inner = phi i1 [ %v4, %left ], [ %v5, %right ]
38 %j.next = add i32 %j, 1
39 br i1 %stay_inner, label %inner, label %outer, !prof !1
41 ; CHECK-NEXT: no_inner: float = 3.0,
43 %continue = call i1 @foo6(i32 %i)
44 br i1 %continue, label %outer, label %exit, !prof !1
46 ; CHECK-NEXT: exit: float = 1.0, int = [[ENTRY]]
59 !0 = !{!"branch_weights", i32 1, i32 3}
60 !1 = !{!"branch_weights", i32 3, i32 1}