1 ; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux < %s | FileCheck %s
3 define void @foo() !prof !1 {
4 ; Test if a cold block in a loop will be placed at the end of the function
19 %call = call zeroext i1 @a()
20 br i1 %call, label %if.then, label %if.else, !prof !4
32 %call2 = call zeroext i1 @a()
33 br i1 %call2, label %header, label %end, !prof !5
40 define void @nested_loop_0(i1 %flag) !prof !1 {
41 ; Test if a block that is cold in the inner loop but not cold in the outer loop
42 ; will merged to the outer loop chain.
44 ; CHECK-LABEL: nested_loop_0:
56 %call4 = call zeroext i1 @a()
57 br i1 %call4, label %header2, label %end
61 %call = call zeroext i1 @a()
62 br i1 %call, label %if.then, label %if.else, !prof !2
66 %call3 = call zeroext i1 @a()
67 br i1 %call3, label %header2, label %header, !prof !3
71 br i1 %flag, label %header2, label %header, !prof !3
78 define void @nested_loop_1() !prof !1 {
79 ; Test if a cold block in an inner loop will be placed at the end of the
82 ; CHECK-LABEL: nested_loop_1:
97 %call = call zeroext i1 @a()
98 br i1 %call, label %end, label %if.else, !prof !4
102 %call2 = call zeroext i1 @a()
103 br i1 %call2, label %header2, label %header, !prof !5
110 declare zeroext i1 @a()
117 !1 = !{!"function_entry_count", i64 1}
118 !2 = !{!"branch_weights", i32 100, i32 1}
119 !3 = !{!"branch_weights", i32 1, i32 10}
120 !4 = !{!"branch_weights", i32 1000, i32 1}
121 !5 = !{!"branch_weights", i32 100, i32 1}