1 ; RUN: opt -passes=synthetic-counts-propagation -S < %s | FileCheck %s
3 ; CHECK-LABEL: define void @level1a(i32 %n)
4 ; CHECK: !prof ![[COUNT1:[0-9]+]]
5 define void @level1a(i32 %n) {
7 %cmp = icmp sgt i32 %n, 10
8 br i1 %cmp, label %exit, label %loop
10 %i = phi i32 [%n, %entry], [%i1, %loop]
11 call void @level2a(i32 %n)
13 %cmp2 = icmp eq i32 %i1, 0
14 br i1 %cmp2, label %exit, label %loop, !prof !1
19 ; CHECK-LABEL: define void @level2a(i32 %n)
20 ; CHECK: !prof ![[COUNT2:[0-9]+]]
21 define void @level2a(i32 %n) {
22 call void @level2b(i32 %n)
26 ; CHECK-LABEL: define void @level2b(i32 %n)
27 ; CHECK: !prof ![[COUNT2]]
28 define void @level2b(i32 %n) {
30 call void @level2a(i32 %n)
31 %cmp = icmp eq i32 %n, 0
32 br i1 %cmp, label %then, label %else, !prof !2
34 call void @level3a(i32 %n)
40 ; CHECK-LABEL: define internal void @level3a(i32 %n)
41 ; CHECK: !prof ![[COUNT3:[0-9]+]]
42 define internal void @level3a(i32 %n) {
46 !1 = !{!"branch_weights", i32 1, i32 99}
47 !2 = !{!"branch_weights", i32 1, i32 1}
48 ; CHECK: ![[COUNT1]] = !{!"synthetic_function_entry_count", i64 10}
49 ; CHECK: ![[COUNT2]] = !{!"synthetic_function_entry_count", i64 520}
50 ; CHECK: ![[COUNT3]] = !{!"synthetic_function_entry_count", i64 260}