1 ; RUN: opt %loadPolly %defaultOpts -polly-codegen -enable-polly-vector -dce -S %s | FileCheck %s
2 ; Obtained from C source as:
3 ; clang -S -emit-llvm -O0 slp-18.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer slp-18.s > slp-18.ll
6 ; ModuleID = 'slp-18.s'
8 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
9 target triple = "x86_64-unknown-linux-gnu"
11 @main1.in = internal unnamed_addr constant [64 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63], align 16
13 define i32 @main1() nounwind uwtable {
15 %out = alloca [64 x i32], align 16
16 %in = alloca [64 x i32], align 16
17 %out2 = alloca [64 x float], align 16
18 %tmp = bitcast [64 x i32]* %in to i8*
19 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp, i8* bitcast ([64 x i32]* @main1.in to i8*), i64 256, i32 16, i1 false)
22 for.cond: ; preds = %for.inc, %entry
23 %indvar73 = phi i64 [ %indvar.next74, %for.inc ], [ 0, %entry ]
24 %tmp75 = mul i64 %indvar73, 8
25 %tmp76 = add i64 %tmp75, 7
26 %arrayidx177 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp76
27 %tmp77 = add i64 %tmp75, 6
28 %arrayidx170 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp77
29 %tmp78 = add i64 %tmp75, 5
30 %arrayidx163 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp78
31 %tmp79 = add i64 %tmp75, 4
32 %arrayidx156 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp79
33 %tmp80 = add i64 %tmp75, 3
34 %arrayidx149 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp80
35 %tmp81 = add i64 %tmp75, 2
36 %arrayidx142 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp81
37 %tmp82 = add i64 %tmp75, 1
38 %arrayidx135 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp82
39 %arrayidx128 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp75
40 %arrayidx123 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp76
41 %arrayidx116 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp77
42 %arrayidx109 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp78
43 %arrayidx102 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp79
44 %arrayidx95 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp80
45 %arrayidx88 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp81
46 %arrayidx81 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp82
47 %arrayidx74 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp75
48 %arrayidx51 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp76
49 %arrayidx44 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp77
50 %arrayidx37 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp78
51 %arrayidx30 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp79
52 %arrayidx23 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp80
53 %arrayidx16 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp81
54 %arrayidx9 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp82
55 %arrayidx = getelementptr [64 x i32]* %in, i64 0, i64 %tmp75
56 %exitcond = icmp ne i64 %indvar73, 8
57 br i1 %exitcond, label %for.body, label %for.end
59 for.body: ; preds = %for.cond
60 %tmp4 = load i32* %arrayidx, align 16
61 %tmp10 = load i32* %arrayidx9, align 4
62 %tmp17 = load i32* %arrayidx16, align 8
63 %tmp24 = load i32* %arrayidx23, align 4
64 %tmp31 = load i32* %arrayidx30, align 16
65 %tmp38 = load i32* %arrayidx37, align 4
66 %tmp45 = load i32* %arrayidx44, align 8
67 %tmp52 = load i32* %arrayidx51, align 4
68 %tmp46 = mul i32 %tmp4, 3
69 %mul55 = add i32 %tmp46, 15
70 %add11 = shl i32 %tmp10, 1
71 %mul57 = add i32 %add11, 12
72 %tmp47 = mul i32 %tmp17, 12
73 %mul59 = add i32 %tmp47, 84
74 %tmp48 = mul i32 %tmp24, 5
75 %mul61 = add i32 %tmp48, 40
76 %add32 = shl i32 %tmp31, 3
77 %mul63 = add i32 %add32, 72
78 %add39 = shl i32 %tmp38, 2
79 %mul65 = add i32 %add39, 40
80 %tmp49 = mul i32 %tmp45, 3
81 %mul67 = add i32 %tmp49, 33
82 %add53 = shl i32 %tmp52, 1
83 %mul69 = add i32 %add53, 24
84 %sub = add i32 %tmp46, 13
85 store i32 %sub, i32* %arrayidx74, align 16
86 %sub76 = add i32 %add11, 9
87 store i32 %sub76, i32* %arrayidx81, align 4
88 %sub83 = add i32 %tmp47, 82
89 store i32 %sub83, i32* %arrayidx88, align 8
90 %sub90 = add i32 %tmp48, 39
91 store i32 %sub90, i32* %arrayidx95, align 4
92 %sub97 = add i32 %add32, 64
93 store i32 %sub97, i32* %arrayidx102, align 16
94 %sub104 = add i32 %add39, 33
95 store i32 %sub104, i32* %arrayidx109, align 4
96 %sub111 = add i32 %tmp49, 30
97 store i32 %sub111, i32* %arrayidx116, align 8
98 %sub118 = add i32 %add53, 17
99 store i32 %sub118, i32* %arrayidx123, align 4
100 %conv = uitofp i32 %mul55 to float
101 store float %conv, float* %arrayidx128, align 16
102 %conv130 = uitofp i32 %mul57 to float
103 store float %conv130, float* %arrayidx135, align 4
104 %conv137 = uitofp i32 %mul59 to float
105 store float %conv137, float* %arrayidx142, align 8
106 %conv144 = uitofp i32 %mul61 to float
107 store float %conv144, float* %arrayidx149, align 4
108 %conv151 = uitofp i32 %mul63 to float
109 store float %conv151, float* %arrayidx156, align 16
110 %conv158 = uitofp i32 %mul65 to float
111 store float %conv158, float* %arrayidx163, align 4
112 %conv165 = uitofp i32 %mul67 to float
113 store float %conv165, float* %arrayidx170, align 8
114 %conv172 = uitofp i32 %mul69 to float
115 store float %conv172, float* %arrayidx177, align 4
118 for.inc: ; preds = %for.body
119 %indvar.next74 = add i64 %indvar73, 1
122 for.end: ; preds = %for.cond
123 br label %for.cond179
125 for.cond179: ; preds = %for.inc467, %for.end
126 %indvar = phi i64 [ %indvar.next, %for.inc467 ], [ 0, %for.end ]
127 %tmp64 = mul i64 %indvar, 8
128 %tmp65 = add i64 %tmp64, 7
129 %arrayidx317 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp65
130 %arrayidx452 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp65
131 %tmp66 = add i64 %tmp64, 6
132 %arrayidx299 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp66
133 %arrayidx434 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp66
134 %tmp67 = add i64 %tmp64, 5
135 %arrayidx281 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp67
136 %arrayidx416 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp67
137 %tmp68 = add i64 %tmp64, 4
138 %arrayidx263 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp68
139 %arrayidx398 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp68
140 %tmp69 = add i64 %tmp64, 3
141 %arrayidx245 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp69
142 %arrayidx380 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp69
143 %tmp70 = add i64 %tmp64, 2
144 %arrayidx227 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp70
145 %arrayidx362 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp70
146 %tmp71 = add i64 %tmp64, 1
147 %arrayidx209 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp71
148 %arrayidx344 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp71
149 %arrayidx192 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp64
150 %arrayidx327 = getelementptr [64 x float]* %out2, i64 0, i64 %tmp64
151 %arrayidx311 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp65
152 %arrayidx293 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp66
153 %arrayidx275 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp67
154 %arrayidx257 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp68
155 %arrayidx239 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp69
156 %arrayidx221 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp70
157 %arrayidx203 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp71
158 %arrayidx187 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp64
159 %i.1 = trunc i64 %indvar to i32
160 %cmp181 = icmp slt i32 %i.1, 8
161 br i1 %cmp181, label %for.body183, label %for.end470
163 for.body183: ; preds = %for.cond179
164 %tmp188 = load i32* %arrayidx187, align 16
165 %tmp193 = load i32* %arrayidx192, align 16
166 %tmp1 = mul i32 %tmp193, 3
167 %sub196 = add i32 %tmp1, 13
168 %cmp197 = icmp eq i32 %tmp188, %sub196
169 br i1 %cmp197, label %lor.lhs.false, label %if.then
171 lor.lhs.false: ; preds = %for.body183
172 %tmp204 = load i32* %arrayidx203, align 4
173 %tmp210 = load i32* %arrayidx209, align 4
174 %add211 = shl i32 %tmp210, 1
175 %sub213 = add i32 %add211, 9
176 %cmp214 = icmp eq i32 %tmp204, %sub213
177 br i1 %cmp214, label %lor.lhs.false216, label %if.then
179 lor.lhs.false216: ; preds = %lor.lhs.false
180 %tmp222 = load i32* %arrayidx221, align 8
181 %tmp228 = load i32* %arrayidx227, align 8
182 %tmp6 = mul i32 %tmp228, 12
183 %sub231 = add i32 %tmp6, 82
184 %cmp232 = icmp eq i32 %tmp222, %sub231
185 br i1 %cmp232, label %lor.lhs.false234, label %if.then
187 lor.lhs.false234: ; preds = %lor.lhs.false216
188 %tmp240 = load i32* %arrayidx239, align 4
189 %tmp246 = load i32* %arrayidx245, align 4
190 %tmp9 = mul i32 %tmp246, 5
191 %sub249 = add i32 %tmp9, 39
192 %cmp250 = icmp eq i32 %tmp240, %sub249
193 br i1 %cmp250, label %lor.lhs.false252, label %if.then
195 lor.lhs.false252: ; preds = %lor.lhs.false234
196 %tmp258 = load i32* %arrayidx257, align 16
197 %tmp264 = load i32* %arrayidx263, align 16
198 %add265 = shl i32 %tmp264, 3
199 %sub267 = add i32 %add265, 64
200 %cmp268 = icmp eq i32 %tmp258, %sub267
201 br i1 %cmp268, label %lor.lhs.false270, label %if.then
203 lor.lhs.false270: ; preds = %lor.lhs.false252
204 %tmp276 = load i32* %arrayidx275, align 4
205 %tmp282 = load i32* %arrayidx281, align 4
206 %add283 = shl i32 %tmp282, 2
207 %sub285 = add i32 %add283, 33
208 %cmp286 = icmp eq i32 %tmp276, %sub285
209 br i1 %cmp286, label %lor.lhs.false288, label %if.then
211 lor.lhs.false288: ; preds = %lor.lhs.false270
212 %tmp294 = load i32* %arrayidx293, align 8
213 %tmp300 = load i32* %arrayidx299, align 8
214 %tmp16 = mul i32 %tmp300, 3
215 %sub303 = add i32 %tmp16, 30
216 %cmp304 = icmp eq i32 %tmp294, %sub303
217 br i1 %cmp304, label %lor.lhs.false306, label %if.then
219 lor.lhs.false306: ; preds = %lor.lhs.false288
220 %tmp312 = load i32* %arrayidx311, align 4
221 %tmp318 = load i32* %arrayidx317, align 4
222 %add319 = shl i32 %tmp318, 1
223 %sub321 = add i32 %add319, 17
224 %cmp322 = icmp eq i32 %tmp312, %sub321
225 br i1 %cmp322, label %if.end, label %if.then
227 if.then: ; preds = %lor.lhs.false306, %lor.lhs.false288, %lor.lhs.false270, %lor.lhs.false252, %lor.lhs.false234, %lor.lhs.false216, %lor.lhs.false, %for.body183
228 call void @abort() noreturn nounwind
231 if.end: ; preds = %lor.lhs.false306
232 %tmp328 = load float* %arrayidx327, align 16
233 %tmp333 = load i32* %arrayidx192, align 16
234 %tmp19 = mul i32 %tmp333, 3
235 %mul335 = add i32 %tmp19, 15
236 %conv336 = uitofp i32 %mul335 to float
237 %cmp337 = fcmp une float %tmp328, %conv336
238 br i1 %cmp337, label %if.then465, label %lor.lhs.false339
240 lor.lhs.false339: ; preds = %if.end
241 %tmp345 = load float* %arrayidx344, align 4
242 %tmp351 = load i32* %arrayidx209, align 4
243 %add352 = shl i32 %tmp351, 1
244 %mul353 = add i32 %add352, 12
245 %conv354 = uitofp i32 %mul353 to float
246 %cmp355 = fcmp une float %tmp345, %conv354
247 br i1 %cmp355, label %if.then465, label %lor.lhs.false357
249 lor.lhs.false357: ; preds = %lor.lhs.false339
250 %tmp363 = load float* %arrayidx362, align 8
251 %tmp369 = load i32* %arrayidx227, align 8
252 %tmp25 = mul i32 %tmp369, 12
253 %mul371 = add i32 %tmp25, 84
254 %conv372 = uitofp i32 %mul371 to float
255 %cmp373 = fcmp une float %tmp363, %conv372
256 br i1 %cmp373, label %if.then465, label %lor.lhs.false375
258 lor.lhs.false375: ; preds = %lor.lhs.false357
259 %tmp381 = load float* %arrayidx380, align 4
260 %tmp387 = load i32* %arrayidx245, align 4
261 %tmp28 = mul i32 %tmp387, 5
262 %mul389 = add i32 %tmp28, 40
263 %conv390 = uitofp i32 %mul389 to float
264 %cmp391 = fcmp une float %tmp381, %conv390
265 br i1 %cmp391, label %if.then465, label %lor.lhs.false393
267 lor.lhs.false393: ; preds = %lor.lhs.false375
268 %tmp399 = load float* %arrayidx398, align 16
269 %tmp405 = load i32* %arrayidx263, align 16
270 %add406 = shl i32 %tmp405, 3
271 %mul407 = add i32 %add406, 72
272 %conv408 = uitofp i32 %mul407 to float
273 %cmp409 = fcmp une float %tmp399, %conv408
274 br i1 %cmp409, label %if.then465, label %lor.lhs.false411
276 lor.lhs.false411: ; preds = %lor.lhs.false393
277 %tmp417 = load float* %arrayidx416, align 4
278 %tmp423 = load i32* %arrayidx281, align 4
279 %add424 = shl i32 %tmp423, 2
280 %mul425 = add i32 %add424, 40
281 %conv426 = uitofp i32 %mul425 to float
282 %cmp427 = fcmp une float %tmp417, %conv426
283 br i1 %cmp427, label %if.then465, label %lor.lhs.false429
285 lor.lhs.false429: ; preds = %lor.lhs.false411
286 %tmp435 = load float* %arrayidx434, align 8
287 %tmp441 = load i32* %arrayidx299, align 8
288 %tmp35 = mul i32 %tmp441, 3
289 %mul443 = add i32 %tmp35, 33
290 %conv444 = uitofp i32 %mul443 to float
291 %cmp445 = fcmp une float %tmp435, %conv444
292 br i1 %cmp445, label %if.then465, label %lor.lhs.false447
294 lor.lhs.false447: ; preds = %lor.lhs.false429
295 %tmp453 = load float* %arrayidx452, align 4
296 %tmp459 = load i32* %arrayidx317, align 4
297 %add460 = shl i32 %tmp459, 1
298 %mul461 = add i32 %add460, 24
299 %conv462 = uitofp i32 %mul461 to float
300 %cmp463 = fcmp une float %tmp453, %conv462
301 br i1 %cmp463, label %if.then465, label %if.end466
303 if.then465: ; preds = %lor.lhs.false447, %lor.lhs.false429, %lor.lhs.false411, %lor.lhs.false393, %lor.lhs.false375, %lor.lhs.false357, %lor.lhs.false339, %if.end
304 call void @abort() noreturn nounwind
307 if.end466: ; preds = %lor.lhs.false447
310 for.inc467: ; preds = %if.end466
311 %indvar.next = add i64 %indvar, 1
312 br label %for.cond179
314 for.end470: ; preds = %for.cond179
318 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
320 declare void @abort() noreturn
322 define i32 @main() nounwind uwtable {
324 call void @check_vect()
325 %call = call i32 @main1()
329 define internal void @check_vect() nounwind uwtable noinline {
331 %a = alloca i32, align 4
332 %b = alloca i32, align 4
333 %c = alloca i32, align 4
334 %d = alloca i32, align 4
335 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
336 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
337 %tobool = icmp eq i32 %call1, 0
338 br i1 %tobool, label %if.then, label %lor.lhs.false
340 lor.lhs.false: ; preds = %entry
341 %tmp4 = load i32* %d, align 4
342 %and6 = and i32 %tmp4, 67108864
343 %cmp = icmp eq i32 %and6, 0
344 br i1 %cmp, label %if.then, label %if.end
346 if.then: ; preds = %entry, %lor.lhs.false
347 call void @exit(i32 0) noreturn nounwind
350 if.end: ; preds = %lor.lhs.false
351 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
355 declare void (i32)* @signal(i32, void (i32)*) nounwind
357 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
359 call void @exit(i32 0) noreturn nounwind
362 return: ; No predecessors!
366 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
368 %and = and i32 %__level, -2147483648
369 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
370 %cmp = icmp ult i32 %call, %__level
371 br i1 %cmp, label %if.then, label %if.end
373 if.then: ; preds = %entry
376 if.end: ; preds = %entry
377 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
378 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
379 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
380 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
381 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
382 store i32 %asmresult, i32* %__eax, align 4
383 store i32 %asmresult8, i32* %__ebx, align 4
384 store i32 %asmresult9, i32* %__ecx, align 4
385 store i32 %asmresult10, i32* %__edx, align 4
388 return: ; preds = %if.end, %if.then
389 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
393 declare void @exit(i32) noreturn
395 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
397 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
398 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
399 %tobool = icmp eq i32* %__sig, null
400 br i1 %tobool, label %if.end, label %if.then
402 if.then: ; preds = %entry
403 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
404 store i32 %asmresult1, i32* %__sig, align 4
407 if.end: ; preds = %entry, %if.then
411 !0 = metadata !{i32 -2147341551, i32 -2147341543}
412 !1 = metadata !{i32 -2147341674, i32 -2147341666}