Bulk erasing instructions without RAUWing them is unsafe. Instead, break them
[oota-llvm.git] / test / Transforms / SimplifyLibCalls / 2009-07-28-Exit.ll
1 ; RUN: llvm-as < %s | opt -simplify-libcalls
2 ; PR4641
3
4         %struct.__sFILE = type { i8*, i32, i32, i16, i16, %struct.__sbuf, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %struct.__sbuf, i8*, i32, [3 x i8], [1 x i8], %struct.__sbuf, i32, i64, %struct.pthread_mutex*, %struct.pthread*, i32, i32, %union.anon }
5         %struct.__sbuf = type { i8*, i32, [4 x i8] }
6         %struct.pthread = type opaque
7         %struct.pthread_mutex = type opaque
8         %union.anon = type { i64, [120 x i8] }
9 @.str13 = external constant [2 x i8]            ; <[2 x i8]*> [#uses=1]
10 @.str14 = external constant [2 x i8]            ; <[2 x i8]*> [#uses=1]
11
12 define i32 @main(i32 %argc, i8** %argv) nounwind {
13 entry:
14         br i1 undef, label %if.then.i, label %xmalloc.exit
15
16 if.then.i:              ; preds = %entry
17         unreachable
18
19 xmalloc.exit:           ; preds = %entry
20         br i1 undef, label %if.then.i11, label %xmalloc.exit13
21
22 if.then.i11:            ; preds = %xmalloc.exit
23         unreachable
24
25 xmalloc.exit13:         ; preds = %xmalloc.exit
26         br label %while.cond
27
28 while.cond:             ; preds = %sw.bb124, %if.end59, %if.end, %while.cond, %xmalloc.exit13
29         switch i32 undef, label %sw.default [
30                 i32 -1, label %for.cond
31                 i32 0, label %while.cond
32                 i32 4097, label %sw.bb36
33                 i32 102, label %sw.bb55
34                 i32 111, label %sw.bb55
35                 i32 108, label %sw.bb62
36                 i32 99, label %sw.bb84
37                 i32 86, label %sw.bb114
38                 i32 66, label %sw.bb124
39         ]
40
41 sw.bb36:                ; preds = %while.cond
42         br i1 undef, label %if.end, label %if.then
43
44 if.then:                ; preds = %sw.bb36
45         unreachable
46
47 if.end:         ; preds = %sw.bb36
48         br label %while.cond
49
50 sw.bb55:                ; preds = %while.cond, %while.cond
51         br i1 undef, label %if.end59, label %if.then58
52
53 if.then58:              ; preds = %sw.bb55
54         br label %if.end59
55
56 if.end59:               ; preds = %if.then58, %sw.bb55
57         br label %while.cond
58
59 sw.bb62:                ; preds = %while.cond
60         unreachable
61
62 sw.bb84:                ; preds = %while.cond
63         unreachable
64
65 sw.bb114:               ; preds = %while.cond
66         unreachable
67
68 sw.bb124:               ; preds = %while.cond
69         br label %while.cond
70
71 sw.default:             ; preds = %while.cond
72         unreachable
73
74 for.cond:               ; preds = %while.cond
75         br i1 undef, label %if.end167, label %if.then8.i
76
77 if.then8.i:             ; preds = %for.cond
78         unreachable
79
80 if.end167:              ; preds = %for.cond
81         br i1 undef, label %if.then174, label %if.end175
82
83 if.then174:             ; preds = %if.end167
84         unreachable
85
86 if.end175:              ; preds = %if.end167
87         br i1 undef, label %if.then179, label %if.end181
88
89 if.then179:             ; preds = %if.end175
90         unreachable
91
92 if.end181:              ; preds = %if.end175
93         br i1 undef, label %if.then.i.i189, label %while.cond.i194
94
95 if.then.i.i189:         ; preds = %if.end181
96         unreachable
97
98 while.cond.i194:                ; preds = %if.end181
99         br i1 undef, label %while.body.i198, label %for.cond.i.i202
100
101 while.body.i198:                ; preds = %while.cond.i194
102         unreachable
103
104 for.cond.i.i202:                ; preds = %while.cond.i194
105         br i1 undef, label %if.end197, label %if.then191
106
107 if.then191:             ; preds = %for.cond.i.i202
108         unreachable
109
110 if.end197:              ; preds = %for.cond.i.i202
111         br label %for.cond.i144
112
113 for.cond.i144:          ; preds = %for.body.i145, %if.end197
114         br i1 undef, label %for.body.i145, label %for.cond24.i
115
116 for.body.i145:          ; preds = %for.cond.i144
117         br label %for.cond.i144
118
119 for.cond24.i:           ; preds = %for.cond.i144
120         br label %for.cond78.i
121
122 for.cond78.i:           ; preds = %for.body84.i, %for.cond24.i
123         br i1 undef, label %for.end94.i, label %for.body84.i
124
125 for.body84.i:           ; preds = %for.cond78.i
126         br label %for.cond78.i
127
128 for.end94.i:            ; preds = %for.cond78.i
129         br i1 undef, label %if.then.i.i139, label %linebuffer_init.exit142
130
131 if.then.i.i139:         ; preds = %for.end94.i
132         br label %linebuffer_init.exit142
133
134 linebuffer_init.exit142:                ; preds = %if.then.i.i139, %for.end94.i
135         br i1 undef, label %if.then.i.i124, label %linebuffer_init.exit129
136
137 if.then.i.i124:         ; preds = %linebuffer_init.exit142
138         unreachable
139
140 linebuffer_init.exit129:                ; preds = %linebuffer_init.exit142
141         br i1 undef, label %if.then.i.i110, label %linebuffer_init.exit113
142
143 if.then.i.i110:         ; preds = %linebuffer_init.exit129
144         unreachable
145
146 linebuffer_init.exit113:                ; preds = %linebuffer_init.exit129
147         br i1 undef, label %if.then.i.i98, label %linebuffer_init.exit
148
149 if.then.i.i98:          ; preds = %linebuffer_init.exit113
150         br label %linebuffer_init.exit
151
152 linebuffer_init.exit:           ; preds = %if.then.i.i98, %linebuffer_init.exit113
153         br i1 undef, label %if.then227, label %while.cond.i50
154
155 if.then227:             ; preds = %linebuffer_init.exit
156         unreachable
157
158 while.cond.i50:         ; preds = %linebuffer_init.exit
159         br i1 undef, label %while.end339, label %while.body334
160
161 while.body334:          ; preds = %while.cond.i50
162         unreachable
163
164 while.end339:           ; preds = %while.cond.i50
165         br i1 undef, label %if.then344, label %if.end346
166
167 if.then344:             ; preds = %while.end339
168         unreachable
169
170 if.end346:              ; preds = %while.end339
171         call void @exit(i32 0) nounwind
172         %cond392 = select i1 undef, i8* getelementptr ([2 x i8]* @.str13, i32 0, i32 0), i8* getelementptr ([2 x i8]* @.str14, i32 0, i32 0)            ; <i8*> [#uses=1]
173         %call393 = call %struct.__sFILE* @fopen(i8* undef, i8* %cond392) nounwind               ; <%struct.__sFILE*> [#uses=0]
174         unreachable
175 }
176
177 declare %struct.__sFILE* @fopen(i8*, i8*)
178
179 declare void @exit(i32)