blob: e47112bb9b3a8ace0d605f02ed48a9d05abf0b92 [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; 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-upgrade < %s | llvm-as | opt -licm -disable-output
8
9%G = weak global int 0 ; <int*> [#uses=13]
10
11implementation ; Functions:
12
13int %main() {
14entry:
15 store int 123, int* %G
16 br label %loopentry.i
17
18loopentry.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
23endif.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
28endif.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
34Out.i: ; preds = %loopentry.i
35 store int 0, int* %G
36 br label %ExitBlock.i
37
38ExitBlock.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