Home | History | Annotate | Download | only in BlockFrequencyInfo
      1 ; RUN: opt < %s -analyze -block-freq | FileCheck %s
      2 ; RUN: opt < %s -passes='print<block-freq>' -disable-output 2>&1 | FileCheck %s
      3 
      4 ; CHECK-LABEL: Printing analysis {{.*}} for function 'loop_with_branch':
      5 ; CHECK-NEXT: block-frequency-info: loop_with_branch
      6 define void @loop_with_branch(i32 %a) {
      7 ; CHECK-NEXT: entry: float = 1.0, int = [[ENTRY:[0-9]+]]
      8 entry:
      9   %skip_loop = call i1 @foo0(i32 %a)
     10   br i1 %skip_loop, label %skip, label %header, !prof !0
     11 
     12 ; CHECK-NEXT: skip: float = 0.25,
     13 skip:
     14   br label %exit
     15 
     16 ; CHECK-NEXT: header: float = 4.5,
     17 header:
     18   %i = phi i32 [ 0, %entry ], [ %i.next, %back ]
     19   %i.next = add i32 %i, 1
     20   %choose = call i2 @foo1(i32 %i)
     21   switch i2 %choose, label %exit [ i2 0, label %left
     22                                    i2 1, label %right ], !prof !1
     23 
     24 ; CHECK-NEXT: left: float = 1.5,
     25 left:
     26   br label %back
     27 
     28 ; CHECK-NEXT: right: float = 2.25,
     29 right:
     30   br label %back
     31 
     32 ; CHECK-NEXT: back: float = 3.75,
     33 back:
     34   br label %header
     35 
     36 ; CHECK-NEXT: exit: float = 1.0, int = [[ENTRY]]
     37 exit:
     38   ret void
     39 }
     40 
     41 declare i1 @foo0(i32)
     42 declare i2 @foo1(i32)
     43 
     44 !0 = !{!"branch_weights", i32 1, i32 3}
     45 !1 = !{!"branch_weights", i32 1, i32 2, i32 3}
     46