1; RUN: llc -mtriple=i686-linux < %s | FileCheck %s
2
3
4define i32 @bar(i32 %count) {
5; Test checks that basic block backedge2 is not moved before header,
6; because it can't reduce taken branches.
7; Later backedge1 and backedge2 is rotated before loop header.
8; CHECK-LABEL: bar
9; CHECK: %.entry
10; CHECK: %.header
11; CHECK: %.backedge1
12; CHECK: %.backedge2
13; CHECK: %.exit
14.entry:
15  %c = shl nsw i32 %count, 2
16  br label %.header
17
18.header:
19  %val1 = call i32 @foo()
20  %cond1 = icmp sgt i32 %val1, 1
21  br i1 %cond1, label %.exit, label %.backedge1
22
23.backedge1:
24  %val2 = call i32 @foo()
25  %cond2 = icmp sgt i32 %val2, 1
26  br i1 %cond2, label %.header, label %.backedge2
27
28.backedge2:
29  %val3 = call i32 @foo()
30  br label %.header
31
32.exit:
33  ret i32 %c
34}
35
36declare i32 @foo()
37