1; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux < %s | FileCheck %s 2; RUN: llc -mcpu=corei7 -mtriple=x86_64-linux -precise-rotation-cost < %s | FileCheck %s -check-prefix=CHECK-PROFILE 3 4define void @foo() { 5; Test a nested loop case when profile data is not available. 6; 7; CHECK-LABEL: foo: 8; CHECK: callq g 9; CHECK: callq h 10; CHECK: callq b 11; CHECK: callq e 12; CHECK: callq f 13; CHECK: callq c 14; CHECK: callq d 15 16entry: 17 br label %header 18 19header: 20 call void @b() 21 %call = call zeroext i1 @a() 22 br i1 %call, label %if.then, label %if.else, !prof !2 23 24if.then: 25 br label %header2 26 27header2: 28 call void @c() 29 %call1 = call zeroext i1 @a() 30 br i1 %call1, label %if.then2, label %if.else2, !prof !2 31 32if.then2: 33 call void @d() 34 br label %if.end2 35 36if.else2: 37 call void @e() 38 br label %if.end2 39 40if.end2: 41 call void @f() 42 %call2 = call zeroext i1 @a() 43 br i1 %call2, label %header2, label %if.end 44 45if.else: 46 call void @g() 47 br label %if.end 48 49if.end: 50 call void @h() 51 %call3 = call zeroext i1 @a() 52 br i1 %call3, label %header, label %end 53 54end: 55 ret void 56} 57 58define void @bar() !prof !1 { 59; Test a nested loop case when profile data is available. 60; 61; CHECK-PROFILE-LABEL: bar: 62; CHECK-PROFILE: callq h 63; CHECK-PROFILE: callq b 64; CHECK-PROFILE: callq g 65; CHECK-PROFILE: callq e 66; CHECK-PROFILE: callq f 67; CHECK-PROFILE: callq c 68; CHECK-PROFILE: callq d 69 70entry: 71 br label %header 72 73header: 74 call void @b() 75 %call = call zeroext i1 @a() 76 br i1 %call, label %if.then, label %if.else, !prof !2 77 78if.then: 79 br label %header2 80 81header2: 82 call void @c() 83 %call1 = call zeroext i1 @a() 84 br i1 %call1, label %if.then2, label %if.else2, !prof !2 85 86if.then2: 87 call void @d() 88 br label %if.end2 89 90if.else2: 91 call void @e() 92 br label %if.end2 93 94if.end2: 95 call void @f() 96 %call2 = call zeroext i1 @a() 97 br i1 %call2, label %header2, label %if.end 98 99if.else: 100 call void @g() 101 br label %if.end 102 103if.end: 104 call void @h() 105 %call3 = call zeroext i1 @a() 106 br i1 %call3, label %header, label %end 107 108end: 109 ret void 110} 111 112declare zeroext i1 @a() 113declare void @b() 114declare void @c() 115declare void @d() 116declare void @e() 117declare void @f() 118declare void @g() 119declare void @h() 120 121!1 = !{!"function_entry_count", i64 1} 122!2 = !{!"branch_weights", i32 16, i32 16} 123