1 ; RUN: llc -mtriple=i686-linux < %s | FileCheck %s
3 ; Don't rotate the loop if the number of fall through to exit is not larger
4 ; than the number of fall through to header.
5 define void @no_rotate() {
6 ; CHECK-LABEL: no_rotate
17 %val1 = call i1 @foo()
18 br i1 %val1, label %middle, label %end
21 %val2 = call i1 @foo()
22 br i1 %val2, label %latch1, label %end
25 %val3 = call i1 @foo()
26 br i1 %val3, label %latch2, label %header
29 %val4 = call i1 @foo()
36 define void @do_rotate() {
37 ; CHECK-LABEL: do_rotate
46 %val0 = call i1 @foo()
47 br i1 %val0, label %then, label %else
58 %val1 = call i1 @foo()
59 br i1 %val1, label %latch1, label %end
62 %val3 = call i1 @foo()
63 br i1 %val3, label %latch2, label %header
66 %val4 = call i1 @foo()
73 ; The loop structure is same as in @no_rotate, but the loop header's predecessor
74 ; doesn't fall through to it, so it should be rotated to get exit fall through.
75 define void @do_rotate2() {
76 ; CHECK-LABEL: do_rotate2
85 %val0 = call i1 @foo()
86 br i1 %val0, label %then, label %header, !prof !1
93 %val1 = call i1 @foo()
94 br i1 %val1, label %middle, label %exit
97 %val2 = call i1 @foo()
98 br i1 %val2, label %latch1, label %exit
101 %val3 = call i1 @foo()
102 br i1 %val3, label %latch2, label %header
105 %val4 = call i1 @foo()
120 !1 = !{!"branch_weights", i32 10, i32 1}