Use the llvm-upgrade program to upgrade llvm assembly.
[oota-llvm.git] / test / Transforms / SimplifyCFG / 2005-06-16-PHICrash.ll
1 ; RUN: llvm-upgrade < %s | llvm-as | opt -simplifycfg -disable-output
2 ; PR584
3
4 %g_38098584 = external global uint              ; <uint*> [#uses=1]
5 %g_60187400 = external global uint              ; <uint*> [#uses=1]
6 %g_59182229 = external global uint              ; <uint*> [#uses=2]
7
8 implementation   ; Functions:
9
10 int %_Z13func_26556482h(ubyte %l_88173906) {
11 entry:
12         %tmp.1 = cast ubyte %l_88173906 to sbyte                ; <sbyte> [#uses=2]
13         %tmp.3 = seteq ubyte %l_88173906, 0             ; <bool> [#uses=1]
14         br bool %tmp.3, label %else.0, label %then.0
15
16 then.0:         ; preds = %entry
17         %tmp.5 = seteq ubyte %l_88173906, 0             ; <bool> [#uses=1]
18         br bool %tmp.5, label %else.1, label %then.1
19
20 then.1:         ; preds = %then.0
21         br label %return
22
23 else.1:         ; preds = %then.0
24         br label %loopentry.0
25
26 loopentry.0:            ; preds = %no_exit.0, %else.1
27         %i.0.1 = phi int [ 0, %else.1 ], [ %inc.0, %no_exit.0 ]         ; <int> [#uses=2]
28         %tmp.9 = setgt int %i.0.1, 99           ; <bool> [#uses=1]
29         br bool %tmp.9, label %endif.0, label %no_exit.0
30
31 no_exit.0:              ; preds = %loopentry.0
32         %inc.0 = add int %i.0.1, 1              ; <int> [#uses=1]
33         br label %loopentry.0
34
35 else.0:         ; preds = %entry
36         %tmp.12 = cast sbyte %tmp.1 to int              ; <int> [#uses=1]
37         br label %return
38
39 endif.0:                ; preds = %loopentry.0
40         %tmp.14 = cast sbyte %tmp.1 to int              ; <int> [#uses=1]
41         %tmp.16 = cast ubyte %l_88173906 to int         ; <int> [#uses=1]
42         %tmp.17 = setgt int %tmp.14, %tmp.16            ; <bool> [#uses=1]
43         %tmp.19 = load uint* %g_59182229                ; <uint> [#uses=2]
44         br bool %tmp.17, label %cond_true, label %cond_false
45
46 cond_true:              ; preds = %endif.0
47         %tmp.20 = setne uint %tmp.19, 1         ; <bool> [#uses=1]
48         br label %cond_continue
49
50 cond_false:             ; preds = %endif.0
51         %tmp.22 = setne uint %tmp.19, 0         ; <bool> [#uses=1]
52         br label %cond_continue
53
54 cond_continue:          ; preds = %cond_false, %cond_true
55         %mem_tmp.0 = phi bool [ %tmp.20, %cond_true ], [ %tmp.22, %cond_false ]         ; <bool> [#uses=1]
56         br bool %mem_tmp.0, label %then.2, label %else.2
57
58 then.2:         ; preds = %cond_continue
59         %tmp.25 = cast ubyte %l_88173906 to int         ; <int> [#uses=1]
60         br label %return
61
62 else.2:         ; preds = %cond_continue
63         br label %loopentry.1
64
65 loopentry.1:            ; preds = %endif.3, %else.2
66         %i.1.1 = phi int [ 0, %else.2 ], [ %inc.3, %endif.3 ]           ; <int> [#uses=2]
67         %i.3.2 = phi int [ undef, %else.2 ], [ %i.3.0, %endif.3 ]               ; <int> [#uses=2]
68         %l_88173906_addr.1 = phi ubyte [ %l_88173906, %else.2 ], [ %l_88173906_addr.0, %endif.3 ]               ; <ubyte> [#uses=3]
69         %tmp.29 = setgt int %i.1.1, 99          ; <bool> [#uses=1]
70         br bool %tmp.29, label %endif.2, label %no_exit.1
71
72 no_exit.1:              ; preds = %loopentry.1
73         %tmp.30 = load uint* %g_38098584                ; <uint> [#uses=1]
74         %tmp.31 = seteq uint %tmp.30, 0         ; <bool> [#uses=1]
75         br bool %tmp.31, label %else.3, label %then.3
76
77 then.3:         ; preds = %no_exit.1
78         br label %endif.3
79
80 else.3:         ; preds = %no_exit.1
81         br bool false, label %else.4, label %then.4
82
83 then.4:         ; preds = %else.3
84         br label %endif.3
85
86 else.4:         ; preds = %else.3
87         br bool false, label %else.5, label %then.5
88
89 then.5:         ; preds = %else.4
90         store uint 3290648471, uint* %g_59182229
91         br label %return
92
93 else.5:         ; preds = %else.4
94         br label %loopentry.3
95
96 loopentry.3:            ; preds = %then.7, %else.5
97         %i.3.3 = phi int [ 0, %else.5 ], [ %inc.2, %then.7 ]            ; <int> [#uses=3]
98         %tmp.55 = setgt int %i.3.3, 99          ; <bool> [#uses=1]
99         br bool %tmp.55, label %endif.3, label %no_exit.3
100
101 no_exit.3:              ; preds = %loopentry.3
102         %tmp.57 = seteq ubyte %l_88173906_addr.1, 0             ; <bool> [#uses=1]
103         br bool %tmp.57, label %else.7, label %then.7
104
105 then.7:         ; preds = %no_exit.3
106         store uint 16239, uint* %g_60187400
107         %inc.2 = add int %i.3.3, 1              ; <int> [#uses=1]
108         br label %loopentry.3
109
110 else.7:         ; preds = %no_exit.3
111         br label %return
112
113 endif.3:                ; preds = %loopentry.3, %then.4, %then.3
114         %i.3.0 = phi int [ %i.3.2, %then.3 ], [ %i.3.2, %then.4 ], [ %i.3.3, %loopentry.3 ]             ; <int> [#uses=1]
115         %l_88173906_addr.0 = phi ubyte [ 100, %then.3 ], [ %l_88173906_addr.1, %then.4 ], [ %l_88173906_addr.1, %loopentry.3 ]          ; <ubyte> [#uses=1]
116         %inc.3 = add int %i.1.1, 1              ; <int> [#uses=1]
117         br label %loopentry.1
118
119 endif.2:                ; preds = %loopentry.1
120         br label %return
121
122 return:         ; preds = %endif.2, %else.7, %then.5, %then.2, %else.0, %then.1
123         %result.0 = phi int [ 1624650671, %then.1 ], [ %tmp.25, %then.2 ], [ 3379, %then.5 ], [ 52410, %else.7 ], [ -1526438411, %endif.2 ], [ %tmp.12, %else.0 ]               ; <int> [#uses=1]
124         ret int %result.0
125 }