Home | History | Annotate | Download | only in SyntheticCountsPropagation
      1 ; RUN: opt -passes=synthetic-counts-propagation -S < %s | FileCheck %s
      2 
      3 ; CHECK-LABEL: define void @level1a(i32 %n)
      4 ; CHECK: !prof ![[COUNT1:[0-9]+]]
      5 define void @level1a(i32 %n) {
      6 entry:
      7   %cmp = icmp sgt i32 %n, 10
      8   br i1 %cmp, label %exit, label %loop
      9 loop:
     10   %i = phi i32 [%n, %entry], [%i1, %loop]
     11   call void @level2a(i32 %n)
     12   %i1 = sub i32 %i, 1
     13   %cmp2 = icmp eq i32 %i1, 0
     14   br i1 %cmp2, label %exit, label %loop, !prof !1
     15 exit:
     16   ret void
     17 }
     18 
     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)
     23   ret void
     24 }
     25 
     26 ; CHECK-LABEL: define void @level2b(i32 %n)
     27 ; CHECK: !prof ![[COUNT2]]
     28 define void @level2b(i32 %n) {
     29 entry:
     30   call void @level2a(i32 %n)
     31   %cmp = icmp eq i32 %n, 0
     32   br i1 %cmp, label %then, label %else, !prof !2
     33 then:
     34   call void @level3a(i32 %n)
     35   br label %else
     36 else:
     37   ret void
     38 }
     39 
     40 ; CHECK-LABEL: define internal void @level3a(i32 %n)
     41 ; CHECK: !prof ![[COUNT3:[0-9]+]]
     42 define internal void @level3a(i32 %n) {
     43   ret void
     44 }
     45 
     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}
     51