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 that not all edges in the loop chain are fall through without profile
6; data.
7;
8; CHECK-LABEL: foo:
9; CHECK: callq e
10; CHECK: callq f
11; CHECK: callq g
12; CHECK: callq h
13
14entry:
15  br label %header
16
17header:
18  call void @e()
19  %call = call zeroext i1 @a()
20  br i1 %call, label %if.then, label %if.else, !prof !2
21
22if.then:
23  call void @f()
24  br label %if.end
25
26if.else:
27  call void @g()
28  br label %if.end
29
30if.end:
31  call void @h()
32  %call2 = call zeroext i1 @a()
33  br i1 %call2, label %header, label %end
34
35end:
36  ret void
37}
38
39define void @bar() !prof !1 {
40; Test that all edges in the loop chain are fall through with profile data.
41;
42; CHECK-PROFILE-LABEL: bar:
43; CHECK-PROFILE: callq g
44; CHECK-PROFILE: callq h
45; CHECK-PROFILE: callq e
46; CHECK-PROFILE: callq f
47
48entry:
49  br label %header
50
51header:
52  call void @e()
53  %call = call zeroext i1 @a()
54  br i1 %call, label %if.then, label %if.else, !prof !2
55
56if.then:
57  call void @f()
58  br label %if.end
59
60if.else:
61  call void @g()
62  br label %if.end
63
64if.end:
65  call void @h()
66  %call2 = call zeroext i1 @a()
67  br i1 %call2, label %header, label %end
68
69end:
70  ret void
71}
72
73declare zeroext i1 @a()
74declare void @e()
75declare void @f()
76declare void @g()
77declare void @h()
78
79!1 = !{!"function_entry_count", i64 1}
80!2 = !{!"branch_weights", i32 16, i32 16}
81