New testcase which caused a bunch of tests to break last night with more
[oota-llvm.git] / test / Transforms / LoopSimplify / 2003-12-10-ExitBlocksProblem.ll
1 ; LoopSimplify is breaking LICM on this testcase because the exit blocks from
2 ; the loop are reachable from more than just the exit nodes: the exit blocks
3 ; have predecessors from outside of the loop!
4 ;
5 ; This is distilled from a monsterous crafty example.
6
7 ; RUN: llvm-as < %s | opt -licm | lli
8
9 %G = weak global int 0          ; <int*> [#uses=13]
10
11 implementation   ; Functions:
12
13 int %main() {
14 entry:
15         store int 123, int* %G
16         br label %loopentry.i
17
18 loopentry.i:            ; preds = %entry, %endif.1.i
19         %tmp.0.i = load int* %G         ; <int> [#uses=1]
20         %tmp.1.i = seteq int %tmp.0.i, 123              ; <bool> [#uses=1]
21         br bool %tmp.1.i, label %Out.i, label %endif.0.i
22
23 endif.0.i:              ; preds = %loopentry.i
24         %tmp.3.i = load int* %G         ; <int> [#uses=1]
25         %tmp.4.i = seteq int %tmp.3.i, 126              ; <bool> [#uses=1]
26         br bool %tmp.4.i, label %ExitBlock.i, label %endif.1.i
27
28 endif.1.i:              ; preds = %endif.0.i
29         %tmp.6.i = load int* %G         ; <int> [#uses=1]
30         %inc.i = add int %tmp.6.i, 1            ; <int> [#uses=1]
31         store int %inc.i, int* %G
32         br label %loopentry.i
33
34 Out.i:          ; preds = %loopentry.i
35         store int 0, int* %G
36         br label %ExitBlock.i
37
38 ExitBlock.i:            ; preds = %endif.0.i, %Out.i
39         %tmp.7.i = load int* %G         ; <int> [#uses=1]
40         ret int %tmp.7.i
41 }
42