1; RUN: opt < %s -analyze -block-freq | FileCheck %s 2 3; CHECK-LABEL: Printing analysis {{.*}} for function 'nested_loop_with_branches' 4; CHECK-NEXT: block-frequency-info: nested_loop_with_branches 5define void @nested_loop_with_branches(i32 %a) { 6; CHECK-NEXT: entry: float = 1.0, int = [[ENTRY:[0-9]+]] 7entry: 8 %v0 = call i1 @foo0(i32 %a) 9 br i1 %v0, label %exit, label %outer, !prof !0 10 11; CHECK-NEXT: outer: float = 12.0, 12outer: 13 %i = phi i32 [ 0, %entry ], [ %i.next, %inner.end ], [ %i.next, %no_inner ] 14 %i.next = add i32 %i, 1 15 %do_inner = call i1 @foo1(i32 %i) 16 br i1 %do_inner, label %no_inner, label %inner, !prof !0 17 18; CHECK-NEXT: inner: float = 36.0, 19inner: 20 %j = phi i32 [ 0, %outer ], [ %j.next, %inner.end ] 21 %side = call i1 @foo3(i32 %j) 22 br i1 %side, label %left, label %right, !prof !0 23 24; CHECK-NEXT: left: float = 9.0, 25left: 26 %v4 = call i1 @foo4(i32 %j) 27 br label %inner.end 28 29; CHECK-NEXT: right: float = 27.0, 30right: 31 %v5 = call i1 @foo5(i32 %j) 32 br label %inner.end 33 34; CHECK-NEXT: inner.end: float = 36.0, 35inner.end: 36 %stay_inner = phi i1 [ %v4, %left ], [ %v5, %right ] 37 %j.next = add i32 %j, 1 38 br i1 %stay_inner, label %inner, label %outer, !prof !1 39 40; CHECK-NEXT: no_inner: float = 3.0, 41no_inner: 42 %continue = call i1 @foo6(i32 %i) 43 br i1 %continue, label %outer, label %exit, !prof !1 44 45; CHECK-NEXT: exit: float = 1.0, int = [[ENTRY]] 46exit: 47 ret void 48} 49 50declare i1 @foo0(i32) 51declare i1 @foo1(i32) 52declare i1 @foo2(i32) 53declare i1 @foo3(i32) 54declare i1 @foo4(i32) 55declare i1 @foo5(i32) 56declare i1 @foo6(i32) 57 58!0 = !{!"branch_weights", i32 1, i32 3} 59!1 = !{!"branch_weights", i32 3, i32 1} 60