]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/Transforms/GVN/2007-07-31-NoDomInherit.ll
Vendor import of llvm trunk r291012:
[FreeBSD/FreeBSD.git] / test / Transforms / GVN / 2007-07-31-NoDomInherit.ll
1 ; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
2
3         %struct.anon = type { i32 (i32, i32, i32)*, i32, i32, [3 x i32], i8*, i8*, i8* }
4 @debug = external constant i32          ; <i32*> [#uses=0]
5 @counters = external constant i32               ; <i32*> [#uses=1]
6 @trialx = external global [17 x i32]            ; <[17 x i32]*> [#uses=1]
7 @dummy1 = external global [7 x i32]             ; <[7 x i32]*> [#uses=0]
8 @dummy2 = external global [4 x i32]             ; <[4 x i32]*> [#uses=0]
9 @unacceptable = external global i32             ; <i32*> [#uses=0]
10 @isa = external global [13 x %struct.anon]              ; <[13 x %struct.anon]*> [#uses=3]
11 @.str = external constant [4 x i8]              ; <[4 x i8]*> [#uses=0]
12 @.str1 = external constant [3 x i8]             ; <[3 x i8]*> [#uses=0]
13 @.str2 = external constant [1 x i8]             ; <[1 x i8]*> [#uses=0]
14 @.str3 = external constant [4 x i8]             ; <[4 x i8]*> [#uses=0]
15 @.str4 = external constant [3 x i8]             ; <[3 x i8]*> [#uses=0]
16 @.str5 = external constant [4 x i8]             ; <[4 x i8]*> [#uses=0]
17 @.str6 = external constant [2 x i8]             ; <[2 x i8]*> [#uses=0]
18 @.str7 = external constant [4 x i8]             ; <[4 x i8]*> [#uses=0]
19 @.str8 = external constant [4 x i8]             ; <[4 x i8]*> [#uses=0]
20 @.str9 = external constant [4 x i8]             ; <[4 x i8]*> [#uses=0]
21 @.str10 = external constant [4 x i8]            ; <[4 x i8]*> [#uses=0]
22 @.str11 = external constant [2 x i8]            ; <[2 x i8]*> [#uses=0]
23 @.str12 = external constant [4 x i8]            ; <[4 x i8]*> [#uses=0]
24 @.str13 = external constant [2 x i8]            ; <[2 x i8]*> [#uses=0]
25 @.str14 = external constant [5 x i8]            ; <[5 x i8]*> [#uses=0]
26 @.str15 = external constant [5 x i8]            ; <[5 x i8]*> [#uses=0]
27 @.str16 = external constant [4 x i8]            ; <[4 x i8]*> [#uses=0]
28 @.str17 = external constant [4 x i8]            ; <[4 x i8]*> [#uses=0]
29 @.str18 = external constant [3 x i8]            ; <[3 x i8]*> [#uses=0]
30 @.str19 = external constant [4 x i8]            ; <[4 x i8]*> [#uses=0]
31 @.str20 = external constant [4 x i8]            ; <[4 x i8]*> [#uses=0]
32 @.str21 = external constant [4 x i8]            ; <[4 x i8]*> [#uses=0]
33 @.str22 = external constant [4 x i8]            ; <[4 x i8]*> [#uses=0]
34 @.str23 = external constant [5 x i8]            ; <[5 x i8]*> [#uses=0]
35 @.str24 = external constant [4 x i8]            ; <[4 x i8]*> [#uses=0]
36 @.str25 = external constant [6 x i8]            ; <[6 x i8]*> [#uses=0]
37 @.str26 = external constant [5 x i8]            ; <[5 x i8]*> [#uses=0]
38 @.str27 = external constant [6 x i8]            ; <[6 x i8]*> [#uses=0]
39 @r = external global [17 x i32]         ; <[17 x i32]*> [#uses=0]
40 @.str28 = external constant [3 x i8]            ; <[3 x i8]*> [#uses=0]
41 @.str29 = external constant [5 x i8]            ; <[5 x i8]*> [#uses=0]
42 @pgm = external global [5 x { i32, [3 x i32] }]         ; <[5 x { i32, [3 x i32] }]*> [#uses=4]
43 @.str30 = external constant [3 x i8]            ; <[3 x i8]*> [#uses=0]
44 @.str31 = external constant [13 x i8]           ; <[13 x i8]*> [#uses=0]
45 @.str32 = external constant [3 x i8]            ; <[3 x i8]*> [#uses=0]
46 @.str33 = external constant [4 x i8]            ; <[4 x i8]*> [#uses=0]
47 @.str34 = external constant [20 x i8]           ; <[20 x i8]*> [#uses=0]
48 @numi = external global i32             ; <i32*> [#uses=7]
49 @.str35 = external constant [10 x i8]           ; <[10 x i8]*> [#uses=0]
50 @counter = external global [5 x i32]            ; <[5 x i32]*> [#uses=2]
51 @itrialx.2510 = external global i32             ; <i32*> [#uses=0]
52 @.str36 = external constant [43 x i8]           ; <[43 x i8]*> [#uses=0]
53 @.str37 = external constant [42 x i8]           ; <[42 x i8]*> [#uses=0]
54 @corr_result = external global i32              ; <i32*> [#uses=0]
55 @.str38 = external constant [3 x i8]            ; <[3 x i8]*> [#uses=0]
56 @.str39 = external constant [5 x i8]            ; <[5 x i8]*> [#uses=0]
57 @.str40 = external constant [47 x i8]           ; <[47 x i8]*> [#uses=0]
58 @correct_result = external global [17 x i32]            ; <[17 x i32]*> [#uses=1]
59 @.str41 = external constant [46 x i8]           ; <[46 x i8]*> [#uses=0]
60 @.str42 = external constant [32 x i8]           ; <[32 x i8]*> [#uses=0]
61 @.str43 = external constant [44 x i8]           ; <[44 x i8]*> [#uses=1]
62 @.str44 = external constant [21 x i8]           ; <[21 x i8]*> [#uses=1]
63 @.str45 = external constant [12 x i8]           ; <[12 x i8]*> [#uses=1]
64 @.str46 = external constant [5 x i8]            ; <[5 x i8]*> [#uses=1]
65 @.str47 = external constant [12 x i8]           ; <[12 x i8]*> [#uses=1]
66
67 declare i32 @neg(i32, i32, i32)
68
69 declare i32 @Not(i32, i32, i32)
70
71 declare i32 @pop(i32, i32, i32)
72
73 declare i32 @nlz(i32, i32, i32)
74
75 declare i32 @rev(i32, i32, i32)
76
77 declare i32 @add(i32, i32, i32)
78
79 declare i32 @sub(i32, i32, i32)
80
81 declare i32 @mul(i32, i32, i32)
82
83 declare i32 @divide(i32, i32, i32)
84
85 declare i32 @divu(i32, i32, i32)
86
87 declare i32 @And(i32, i32, i32)
88
89 declare i32 @Or(i32, i32, i32)
90
91 declare i32 @Xor(i32, i32, i32)
92
93 declare i32 @rotl(i32, i32, i32)
94
95 declare i32 @shl(i32, i32, i32)
96
97 declare i32 @shr(i32, i32, i32)
98
99 declare i32 @shrs(i32, i32, i32)
100
101 declare i32 @cmpeq(i32, i32, i32)
102
103 declare i32 @cmplt(i32, i32, i32)
104
105 declare i32 @cmpltu(i32, i32, i32)
106
107 declare i32 @seleq(i32, i32, i32)
108
109 declare i32 @sellt(i32, i32, i32)
110
111 declare i32 @selle(i32, i32, i32)
112
113 declare void @print_expr(i32)
114
115 declare i32 @printf(i8*, ...)
116
117 declare i32 @putchar(i32)
118
119 declare void @print_pgm()
120
121 declare void @simulate_one_instruction(i32)
122
123 declare i32 @check(i32)
124
125 declare i32 @puts(i8*)
126
127 declare void @fix_operands(i32)
128
129 declare void @abort()
130
131 declare i32 @increment()
132
133 declare i32 @search()
134
135 define i32 @main(i32 %argc, i8** %argv) {
136 entry:
137         %argc_addr = alloca i32         ; <i32*> [#uses=1]
138         %argv_addr = alloca i8**                ; <i8***> [#uses=1]
139         %retval = alloca i32, align 4           ; <i32*> [#uses=2]
140         %tmp = alloca i32, align 4              ; <i32*> [#uses=2]
141         %i = alloca i32, align 4                ; <i32*> [#uses=21]
142         %num_sol = alloca i32, align 4          ; <i32*> [#uses=4]
143         %total = alloca i32, align 4            ; <i32*> [#uses=4]
144         %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
145         store i32 %argc, i32* %argc_addr
146         store i8** %argv, i8*** %argv_addr
147         store i32 0, i32* %num_sol
148         store i32 1, i32* @numi
149         br label %bb91
150
151 bb:             ; preds = %cond_next97
152         %tmp1 = load i32, i32* @numi            ; <i32> [#uses=1]
153         %tmp2 = getelementptr [44 x i8], [44 x i8]* @.str43, i32 0, i32 0               ; <i8*> [#uses=1]
154         %tmp3 = call i32 (i8*, ...) @printf( i8* %tmp2, i32 %tmp1 )             ; <i32> [#uses=0]
155         store i32 0, i32* %i
156         br label %bb13
157
158 bb4:            ; preds = %bb13
159         %tmp5 = load i32, i32* %i               ; <i32> [#uses=1]
160         %tmp6 = load i32, i32* %i               ; <i32> [#uses=1]
161         %tmp7 = getelementptr [17 x i32], [17 x i32]* @trialx, i32 0, i32 %tmp6         ; <i32*> [#uses=1]
162         %tmp8 = load i32, i32* %tmp7            ; <i32> [#uses=1]
163         %tmp9 = call i32 @userfun( i32 %tmp8 )          ; <i32> [#uses=1]
164         %tmp10 = getelementptr [17 x i32], [17 x i32]* @correct_result, i32 0, i32 %tmp5                ; <i32*> [#uses=1]
165         store i32 %tmp9, i32* %tmp10
166         %tmp11 = load i32, i32* %i              ; <i32> [#uses=1]
167         %tmp12 = add i32 %tmp11, 1              ; <i32> [#uses=1]
168         store i32 %tmp12, i32* %i
169         br label %bb13
170
171 bb13:           ; preds = %bb4, %bb
172         %tmp14 = load i32, i32* %i              ; <i32> [#uses=1]
173         %tmp15 = icmp sle i32 %tmp14, 16                ; <i1> [#uses=1]
174         %tmp1516 = zext i1 %tmp15 to i32                ; <i32> [#uses=1]
175         %toBool = icmp ne i32 %tmp1516, 0               ; <i1> [#uses=1]
176         br i1 %toBool, label %bb4, label %bb17
177
178 bb17:           ; preds = %bb13
179         store i32 0, i32* %i
180         br label %bb49
181
182 bb18:           ; preds = %bb49
183         %tmp19 = load i32, i32* %i              ; <i32> [#uses=1]
184         %tmp20 = getelementptr [5 x { i32, [3 x i32] }], [5 x { i32, [3 x i32] }]* @pgm, i32 0, i32 %tmp19              ; <{ i32, [3 x i32] }*> [#uses=1]
185         %tmp21 = getelementptr { i32, [3 x i32] }, { i32, [3 x i32] }* %tmp20, i32 0, i32 0             ; <i32*> [#uses=1]
186         store i32 0, i32* %tmp21
187         %tmp22 = load i32, i32* %i              ; <i32> [#uses=1]
188         %tmp23 = getelementptr [13 x %struct.anon], [13 x %struct.anon]* @isa, i32 0, i32 0             ; <%struct.anon*> [#uses=1]
189         %tmp24 = getelementptr %struct.anon, %struct.anon* %tmp23, i32 0, i32 3         ; <[3 x i32]*> [#uses=1]
190         %tmp25 = getelementptr [3 x i32], [3 x i32]* %tmp24, i32 0, i32 0               ; <i32*> [#uses=1]
191         %tmp26 = load i32, i32* %tmp25          ; <i32> [#uses=1]
192         %tmp27 = getelementptr [5 x { i32, [3 x i32] }], [5 x { i32, [3 x i32] }]* @pgm, i32 0, i32 %tmp22              ; <{ i32, [3 x i32] }*> [#uses=1]
193         %tmp28 = getelementptr { i32, [3 x i32] }, { i32, [3 x i32] }* %tmp27, i32 0, i32 1             ; <[3 x i32]*> [#uses=1]
194         %tmp29 = getelementptr [3 x i32], [3 x i32]* %tmp28, i32 0, i32 0               ; <i32*> [#uses=1]
195         store i32 %tmp26, i32* %tmp29
196         %tmp30 = load i32, i32* %i              ; <i32> [#uses=1]
197         %tmp31 = getelementptr [13 x %struct.anon], [13 x %struct.anon]* @isa, i32 0, i32 0             ; <%struct.anon*> [#uses=1]
198         %tmp32 = getelementptr %struct.anon, %struct.anon* %tmp31, i32 0, i32 3         ; <[3 x i32]*> [#uses=1]
199         %tmp33 = getelementptr [3 x i32], [3 x i32]* %tmp32, i32 0, i32 1               ; <i32*> [#uses=1]
200         %tmp34 = load i32, i32* %tmp33          ; <i32> [#uses=1]
201         %tmp35 = getelementptr [5 x { i32, [3 x i32] }], [5 x { i32, [3 x i32] }]* @pgm, i32 0, i32 %tmp30              ; <{ i32, [3 x i32] }*> [#uses=1]
202         %tmp36 = getelementptr { i32, [3 x i32] }, { i32, [3 x i32] }* %tmp35, i32 0, i32 1             ; <[3 x i32]*> [#uses=1]
203         %tmp37 = getelementptr [3 x i32], [3 x i32]* %tmp36, i32 0, i32 1               ; <i32*> [#uses=1]
204         store i32 %tmp34, i32* %tmp37
205         %tmp38 = load i32, i32* %i              ; <i32> [#uses=1]
206         %tmp39 = getelementptr [13 x %struct.anon], [13 x %struct.anon]* @isa, i32 0, i32 0             ; <%struct.anon*> [#uses=1]
207         %tmp40 = getelementptr %struct.anon, %struct.anon* %tmp39, i32 0, i32 3         ; <[3 x i32]*> [#uses=1]
208         %tmp41 = getelementptr [3 x i32], [3 x i32]* %tmp40, i32 0, i32 2               ; <i32*> [#uses=1]
209         %tmp42 = load i32, i32* %tmp41          ; <i32> [#uses=1]
210         %tmp43 = getelementptr [5 x { i32, [3 x i32] }], [5 x { i32, [3 x i32] }]* @pgm, i32 0, i32 %tmp38              ; <{ i32, [3 x i32] }*> [#uses=1]
211         %tmp44 = getelementptr { i32, [3 x i32] }, { i32, [3 x i32] }* %tmp43, i32 0, i32 1             ; <[3 x i32]*> [#uses=1]
212         %tmp45 = getelementptr [3 x i32], [3 x i32]* %tmp44, i32 0, i32 2               ; <i32*> [#uses=1]
213         store i32 %tmp42, i32* %tmp45
214         %tmp46 = load i32, i32* %i              ; <i32> [#uses=1]
215         call void @fix_operands( i32 %tmp46 )
216         %tmp47 = load i32, i32* %i              ; <i32> [#uses=1]
217 ; CHECK: %tmp47 = phi i32 [ %tmp48, %bb18 ], [ 0, %bb17 ]
218         %tmp48 = add i32 %tmp47, 1              ; <i32> [#uses=1]
219         store i32 %tmp48, i32* %i
220         br label %bb49
221
222 bb49:           ; preds = %bb18, %bb17
223         %tmp50 = load i32, i32* @numi           ; <i32> [#uses=1]
224         %tmp51 = load i32, i32* %i              ; <i32> [#uses=1]
225         %tmp52 = icmp slt i32 %tmp51, %tmp50            ; <i1> [#uses=1]
226         %tmp5253 = zext i1 %tmp52 to i32                ; <i32> [#uses=1]
227         %toBool54 = icmp ne i32 %tmp5253, 0             ; <i1> [#uses=1]
228         br i1 %toBool54, label %bb18, label %bb55
229
230 bb55:           ; preds = %bb49
231         %tmp56 = call i32 @search( )            ; <i32> [#uses=1]
232         store i32 %tmp56, i32* %num_sol
233         %tmp57 = getelementptr [21 x i8], [21 x i8]* @.str44, i32 0, i32 0              ; <i8*> [#uses=1]
234         %tmp58 = load i32, i32* %num_sol                ; <i32> [#uses=1]
235         %tmp59 = call i32 (i8*, ...) @printf( i8* %tmp57, i32 %tmp58 )          ; <i32> [#uses=0]
236         %tmp60 = load i32, i32* @counters               ; <i32> [#uses=1]
237         %tmp61 = icmp ne i32 %tmp60, 0          ; <i1> [#uses=1]
238         %tmp6162 = zext i1 %tmp61 to i32                ; <i32> [#uses=1]
239         %toBool63 = icmp ne i32 %tmp6162, 0             ; <i1> [#uses=1]
240         br i1 %toBool63, label %cond_true, label %cond_next
241
242 cond_true:              ; preds = %bb55
243         store i32 0, i32* %total
244         %tmp64 = getelementptr [12 x i8], [12 x i8]* @.str45, i32 0, i32 0              ; <i8*> [#uses=1]
245         %tmp65 = call i32 (i8*, ...) @printf( i8* %tmp64 )              ; <i32> [#uses=0]
246         store i32 0, i32* %i
247         br label %bb79
248
249 bb66:           ; preds = %bb79
250         %tmp67 = load i32, i32* %i              ; <i32> [#uses=1]
251         %tmp68 = getelementptr [5 x i32], [5 x i32]* @counter, i32 0, i32 %tmp67                ; <i32*> [#uses=1]
252         %tmp69 = load i32, i32* %tmp68          ; <i32> [#uses=1]
253         %tmp70 = getelementptr [5 x i8], [5 x i8]* @.str46, i32 0, i32 0                ; <i8*> [#uses=1]
254         %tmp71 = call i32 (i8*, ...) @printf( i8* %tmp70, i32 %tmp69 )          ; <i32> [#uses=0]
255         %tmp72 = load i32, i32* %i              ; <i32> [#uses=1]
256         %tmp73 = getelementptr [5 x i32], [5 x i32]* @counter, i32 0, i32 %tmp72                ; <i32*> [#uses=1]
257         %tmp74 = load i32, i32* %tmp73          ; <i32> [#uses=1]
258         %tmp75 = load i32, i32* %total          ; <i32> [#uses=1]
259         %tmp76 = add i32 %tmp74, %tmp75         ; <i32> [#uses=1]
260         store i32 %tmp76, i32* %total
261         %tmp77 = load i32, i32* %i              ; <i32> [#uses=1]
262         %tmp78 = add i32 %tmp77, 1              ; <i32> [#uses=1]
263         store i32 %tmp78, i32* %i
264         br label %bb79
265
266 bb79:           ; preds = %bb66, %cond_true
267         %tmp80 = load i32, i32* @numi           ; <i32> [#uses=1]
268         %tmp81 = load i32, i32* %i              ; <i32> [#uses=1]
269         %tmp82 = icmp slt i32 %tmp81, %tmp80            ; <i1> [#uses=1]
270         %tmp8283 = zext i1 %tmp82 to i32                ; <i32> [#uses=1]
271         %toBool84 = icmp ne i32 %tmp8283, 0             ; <i1> [#uses=1]
272         br i1 %toBool84, label %bb66, label %bb85
273
274 bb85:           ; preds = %bb79
275         %tmp86 = getelementptr [12 x i8], [12 x i8]* @.str47, i32 0, i32 0              ; <i8*> [#uses=1]
276         %tmp87 = load i32, i32* %total          ; <i32> [#uses=1]
277         %tmp88 = call i32 (i8*, ...) @printf( i8* %tmp86, i32 %tmp87 )          ; <i32> [#uses=0]
278         br label %cond_next
279
280 cond_next:              ; preds = %bb85, %bb55
281         %tmp89 = load i32, i32* @numi           ; <i32> [#uses=1]
282         %tmp90 = add i32 %tmp89, 1              ; <i32> [#uses=1]
283         store i32 %tmp90, i32* @numi
284         br label %bb91
285
286 bb91:           ; preds = %cond_next, %entry
287         %tmp92 = load i32, i32* @numi           ; <i32> [#uses=1]
288         %tmp93 = icmp sgt i32 %tmp92, 5         ; <i1> [#uses=1]
289         %tmp9394 = zext i1 %tmp93 to i32                ; <i32> [#uses=1]
290         %toBool95 = icmp ne i32 %tmp9394, 0             ; <i1> [#uses=1]
291         br i1 %toBool95, label %cond_true96, label %cond_next97
292
293 cond_true96:            ; preds = %bb91
294         br label %bb102
295
296 cond_next97:            ; preds = %bb91
297         %tmp98 = load i32, i32* %num_sol                ; <i32> [#uses=1]
298         %tmp99 = icmp eq i32 %tmp98, 0          ; <i1> [#uses=1]
299         %tmp99100 = zext i1 %tmp99 to i32               ; <i32> [#uses=1]
300         %toBool101 = icmp ne i32 %tmp99100, 0           ; <i1> [#uses=1]
301         br i1 %toBool101, label %bb, label %bb102
302
303 bb102:          ; preds = %cond_next97, %cond_true96
304         store i32 0, i32* %tmp
305         %tmp103 = load i32, i32* %tmp           ; <i32> [#uses=1]
306         store i32 %tmp103, i32* %retval
307         br label %return
308
309 return:         ; preds = %bb102
310         %retval104 = load i32, i32* %retval             ; <i32> [#uses=1]
311         ret i32 %retval104
312 }
313
314 declare i32 @userfun(i32)