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 vect-strided-u8-i8-gap7.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-strided-u8-i8-gap7.s > vect-strided-u8-i8-gap7.ll
6 ; ModuleID = 'vect-strided-u8-i8-gap7.s'
7 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"
8 target triple = "x86_64-unknown-linux-gnu"
10 %struct.s = type { i8, i8, i8, i8, i8, i8, i8, i8 }
12 define i32 @main1(%struct.s* %arr) nounwind uwtable noinline {
14 %res = alloca [16 x %struct.s], align 16
17 for.cond: ; preds = %for.inc, %entry
18 %indvar15 = phi i64 [ %indvar.next16, %for.inc ], [ 0, %entry ]
19 %g = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar15, i32 6
20 %h114 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar15, i32 7
21 %e107 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar15, i32 4
22 %f94 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar15, i32 5
23 %b81 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar15, i32 1
24 %d62 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar15, i32 3
25 %scevgep23 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar15
26 %a52 = bitcast %struct.s* %scevgep23 to i8*
27 %c30 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar15, i32 2
28 %d = getelementptr %struct.s* %arr, i64 %indvar15, i32 3
29 %e = getelementptr %struct.s* %arr, i64 %indvar15, i32 4
30 %b = getelementptr %struct.s* %arr, i64 %indvar15, i32 1
31 %h = getelementptr %struct.s* %arr, i64 %indvar15, i32 7
32 %f = getelementptr %struct.s* %arr, i64 %indvar15, i32 5
33 %scevgep31 = getelementptr %struct.s* %arr, i64 %indvar15
34 %a = bitcast %struct.s* %scevgep31 to i8*
35 %c = getelementptr %struct.s* %arr, i64 %indvar15, i32 2
36 %exitcond = icmp ne i64 %indvar15, 16
37 br i1 %exitcond, label %for.body, label %for.end
39 for.body: ; preds = %for.cond
40 %tmp11 = load i8* %b, align 1
41 %tmp13 = load i8* %a, align 1
42 %sub = sub i8 %tmp11, %tmp13
43 %tmp17 = load i8* %d, align 1
44 %tmp20 = load i8* %c, align 1
45 %sub22 = sub i8 %tmp17, %tmp20
46 %add = add i8 %sub, %sub22
47 store i8 %add, i8* %c30, align 2
48 %tmp33 = load i8* %b, align 1
49 %tmp37 = load i8* %d, align 1
50 %add39 = add i8 %tmp33, %tmp37
51 %tmp43 = load i8* %a, align 1
52 %add47 = add i8 %tmp43, %add39
53 store i8 %add47, i8* %a52, align 8
54 %add57 = add i8 %sub, %sub22
55 store i8 %add57, i8* %d62, align 1
56 %tmp64 = load i8* %h, align 1
57 %tmp68 = load i8* %a, align 1
58 %sub70 = sub i8 %tmp64, %tmp68
59 %add76 = add i8 %sub70, %sub22
60 store i8 %add76, i8* %b81, align 1
61 %tmp83 = load i8* %f, align 1
62 %tmp87 = load i8* %h, align 1
63 %add89 = add i8 %tmp83, %tmp87
64 store i8 %add89, i8* %f94, align 1
65 %tmp97 = load i8* %b, align 1
66 %tmp100 = load i8* %e, align 1
67 %add102 = add i8 %tmp97, %tmp100
68 store i8 %add102, i8* %e107, align 4
69 %tmp110 = load i8* %d, align 1
70 store i8 %tmp110, i8* %h114, align 1
71 %add119 = add i8 %sub, %sub22
72 store i8 %add119, i8* %g, align 2
75 for.inc: ; preds = %for.body
76 %indvar.next16 = add i64 %indvar15, 1
79 for.end: ; preds = %for.cond
82 for.cond126: ; preds = %for.inc385, %for.end
83 %indvar = phi i64 [ %indvar.next, %for.inc385 ], [ 0, %for.end ]
84 %c164 = getelementptr %struct.s* %arr, i64 %indvar, i32 2
85 %d156 = getelementptr %struct.s* %arr, i64 %indvar, i32 3
86 %scevgep = getelementptr %struct.s* %arr, i64 %indvar
87 %a148 = bitcast %struct.s* %scevgep to i8*
88 %b141 = getelementptr %struct.s* %arr, i64 %indvar, i32 1
89 %g349 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 6
90 %h333 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 7
91 %e323 = getelementptr %struct.s* %arr, i64 %indvar, i32 4
92 %e309 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 4
93 %h252 = getelementptr %struct.s* %arr, i64 %indvar, i32 7
94 %f292 = getelementptr %struct.s* %arr, i64 %indvar, i32 5
95 %f285 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 5
96 %b245 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 1
97 %d205 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 3
98 %scevgep12 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar
99 %a173 = bitcast %struct.s* %scevgep12 to i8*
100 %c134 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 2
101 %i.1 = trunc i64 %indvar to i32
102 %cmp128 = icmp slt i32 %i.1, 16
103 br i1 %cmp128, label %for.body130, label %for.end388
105 for.body130: ; preds = %for.cond126
106 %tmp135 = load i8* %c134, align 2
107 %conv136 = zext i8 %tmp135 to i32
108 %tmp142 = load i8* %b141, align 1
109 %conv143 = zext i8 %tmp142 to i32
110 %tmp149 = load i8* %a148, align 1
111 %conv150 = zext i8 %tmp149 to i32
112 %sub151 = sub nsw i32 %conv143, %conv150
113 %tmp157 = load i8* %d156, align 1
114 %conv158 = zext i8 %tmp157 to i32
115 %add159 = add nsw i32 %sub151, %conv158
116 %tmp165 = load i8* %c164, align 1
117 %conv166 = zext i8 %tmp165 to i32
118 %sub167 = sub nsw i32 %add159, %conv166
119 %cmp168 = icmp eq i32 %conv136, %sub167
120 br i1 %cmp168, label %lor.lhs.false, label %if.then
122 lor.lhs.false: ; preds = %for.body130
123 %tmp174 = load i8* %a173, align 8
124 %conv175 = zext i8 %tmp174 to i32
125 %tmp181 = load i8* %a148, align 1
126 %conv182 = zext i8 %tmp181 to i32
127 %tmp188 = load i8* %b141, align 1
128 %conv189 = zext i8 %tmp188 to i32
129 %add190 = add nsw i32 %conv182, %conv189
130 %tmp196 = load i8* %d156, align 1
131 %conv197 = zext i8 %tmp196 to i32
132 %add198 = add nsw i32 %add190, %conv197
133 %cmp199 = icmp eq i32 %conv175, %add198
134 br i1 %cmp199, label %lor.lhs.false201, label %if.then
136 lor.lhs.false201: ; preds = %lor.lhs.false
137 %tmp206 = load i8* %d205, align 1
138 %conv207 = zext i8 %tmp206 to i32
139 %tmp213 = load i8* %b141, align 1
140 %conv214 = zext i8 %tmp213 to i32
141 %tmp220 = load i8* %a148, align 1
142 %conv221 = zext i8 %tmp220 to i32
143 %sub222 = sub nsw i32 %conv214, %conv221
144 %tmp228 = load i8* %d156, align 1
145 %conv229 = zext i8 %tmp228 to i32
146 %add230 = add nsw i32 %sub222, %conv229
147 %tmp236 = load i8* %c164, align 1
148 %conv237 = zext i8 %tmp236 to i32
149 %sub238 = sub nsw i32 %add230, %conv237
150 %cmp239 = icmp eq i32 %conv207, %sub238
151 br i1 %cmp239, label %lor.lhs.false241, label %if.then
153 lor.lhs.false241: ; preds = %lor.lhs.false201
154 %tmp246 = load i8* %b245, align 1
155 %conv247 = zext i8 %tmp246 to i32
156 %tmp253 = load i8* %h252, align 1
157 %conv254 = zext i8 %tmp253 to i32
158 %tmp260 = load i8* %a148, align 1
159 %conv261 = zext i8 %tmp260 to i32
160 %sub262 = sub nsw i32 %conv254, %conv261
161 %tmp268 = load i8* %d156, align 1
162 %conv269 = zext i8 %tmp268 to i32
163 %add270 = add nsw i32 %sub262, %conv269
164 %tmp276 = load i8* %c164, align 1
165 %conv277 = zext i8 %tmp276 to i32
166 %sub278 = sub nsw i32 %add270, %conv277
167 %cmp279 = icmp eq i32 %conv247, %sub278
168 br i1 %cmp279, label %lor.lhs.false281, label %if.then
170 lor.lhs.false281: ; preds = %lor.lhs.false241
171 %tmp286 = load i8* %f285, align 1
172 %conv287 = zext i8 %tmp286 to i32
173 %tmp293 = load i8* %f292, align 1
174 %conv294 = zext i8 %tmp293 to i32
175 %tmp300 = load i8* %h252, align 1
176 %conv301 = zext i8 %tmp300 to i32
177 %add302 = add nsw i32 %conv294, %conv301
178 %cmp303 = icmp eq i32 %conv287, %add302
179 br i1 %cmp303, label %lor.lhs.false305, label %if.then
181 lor.lhs.false305: ; preds = %lor.lhs.false281
182 %tmp310 = load i8* %e309, align 4
183 %conv311 = zext i8 %tmp310 to i32
184 %tmp317 = load i8* %b141, align 1
185 %conv318 = zext i8 %tmp317 to i32
186 %tmp324 = load i8* %e323, align 1
187 %conv325 = zext i8 %tmp324 to i32
188 %add326 = add nsw i32 %conv318, %conv325
189 %cmp327 = icmp eq i32 %conv311, %add326
190 br i1 %cmp327, label %lor.lhs.false329, label %if.then
192 lor.lhs.false329: ; preds = %lor.lhs.false305
193 %tmp334 = load i8* %h333, align 1
194 %tmp341 = load i8* %d156, align 1
195 %cmp343 = icmp eq i8 %tmp334, %tmp341
196 br i1 %cmp343, label %lor.lhs.false345, label %if.then
198 lor.lhs.false345: ; preds = %lor.lhs.false329
199 %tmp350 = load i8* %g349, align 2
200 %conv351 = zext i8 %tmp350 to i32
201 %tmp357 = load i8* %b141, align 1
202 %conv358 = zext i8 %tmp357 to i32
203 %tmp364 = load i8* %a148, align 1
204 %conv365 = zext i8 %tmp364 to i32
205 %sub366 = sub nsw i32 %conv358, %conv365
206 %tmp372 = load i8* %d156, align 1
207 %conv373 = zext i8 %tmp372 to i32
208 %add374 = add nsw i32 %sub366, %conv373
209 %tmp380 = load i8* %c164, align 1
210 %conv381 = zext i8 %tmp380 to i32
211 %sub382 = sub nsw i32 %add374, %conv381
212 %cmp383 = icmp eq i32 %conv351, %sub382
213 br i1 %cmp383, label %if.end, label %if.then
215 if.then: ; preds = %lor.lhs.false345, %lor.lhs.false329, %lor.lhs.false305, %lor.lhs.false281, %lor.lhs.false241, %lor.lhs.false201, %lor.lhs.false, %for.body130
216 call void @abort() noreturn nounwind
219 if.end: ; preds = %lor.lhs.false345
222 for.inc385: ; preds = %if.end
223 %indvar.next = add i64 %indvar, 1
224 br label %for.cond126
226 for.end388: ; preds = %for.cond126
230 declare void @abort() noreturn
232 define i32 @main() nounwind uwtable {
234 %arr = alloca [16 x %struct.s], align 16
235 call void @check_vect()
238 for.cond: ; preds = %for.inc, %entry
239 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
240 %tmp = add i64 %indvar, -3
241 %conv30 = trunc i64 %tmp to i8
242 %tmp2 = mul i64 %indvar, 2
243 %conv4 = trunc i64 %tmp2 to i8
244 %scevgep = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar
245 %a = bitcast %struct.s* %scevgep to i8*
246 %h = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar, i32 7
247 %g = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar, i32 6
248 %f = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar, i32 5
249 %tmp8 = mul i64 %indvar, 5
250 %conv25 = trunc i64 %tmp8 to i8
251 %e = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar, i32 4
252 %tmp11 = mul i64 %indvar, 3
253 %tmp12 = add i64 %tmp11, 5
254 %conv19 = trunc i64 %tmp12 to i8
255 %d = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar, i32 3
256 %tmp15 = add i64 %indvar, 34
257 %conv12 = trunc i64 %tmp15 to i8
258 %c = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar, i32 2
259 %b = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar, i32 1
260 %conv = trunc i64 %indvar to i8
261 %i.0 = trunc i64 %indvar to i32
262 %cmp = icmp slt i32 %i.0, 16
263 br i1 %cmp, label %for.body, label %for.end
265 for.body: ; preds = %for.cond
266 store i8 %conv, i8* %a, align 8
267 store i8 %conv4, i8* %b, align 1
268 store i8 17, i8* %c, align 2
269 store i8 %conv12, i8* %d, align 1
270 store i8 %conv19, i8* %e, align 4
271 store i8 %conv25, i8* %f, align 1
272 store i8 %conv30, i8* %g, align 2
273 store i8 67, i8* %h, align 1
274 %tmp41 = load i8* %a, align 8
275 %cmp43 = icmp eq i8 %tmp41, -78
276 br i1 %cmp43, label %if.then, label %if.end
278 if.then: ; preds = %for.body
279 call void @abort() noreturn nounwind
282 if.end: ; preds = %for.body
285 for.inc: ; preds = %if.end
286 %indvar.next = add i64 %indvar, 1
289 for.end: ; preds = %for.cond
290 %arraydecay = getelementptr inbounds [16 x %struct.s]* %arr, i64 0, i64 0
291 %call = call i32 @main1(%struct.s* %arraydecay)
295 define internal void @check_vect() nounwind uwtable noinline {
297 %a = alloca i32, align 4
298 %b = alloca i32, align 4
299 %c = alloca i32, align 4
300 %d = alloca i32, align 4
301 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
302 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
303 %tobool = icmp eq i32 %call1, 0
304 br i1 %tobool, label %if.then, label %lor.lhs.false
306 lor.lhs.false: ; preds = %entry
307 %tmp4 = load i32* %d, align 4
308 %and6 = and i32 %tmp4, 67108864
309 %cmp = icmp eq i32 %and6, 0
310 br i1 %cmp, label %if.then, label %if.end
312 if.then: ; preds = %entry, %lor.lhs.false
313 call void @exit(i32 0) noreturn nounwind
316 if.end: ; preds = %lor.lhs.false
317 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
321 declare void (i32)* @signal(i32, void (i32)*) nounwind
323 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
325 call void @exit(i32 0) noreturn nounwind
328 return: ; No predecessors!
332 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
334 %and = and i32 %__level, -2147483648
335 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
336 %cmp = icmp ult i32 %call, %__level
337 br i1 %cmp, label %if.then, label %if.end
339 if.then: ; preds = %entry
342 if.end: ; preds = %entry
343 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
344 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
345 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
346 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
347 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
348 store i32 %asmresult, i32* %__eax, align 4
349 store i32 %asmresult8, i32* %__ebx, align 4
350 store i32 %asmresult9, i32* %__ecx, align 4
351 store i32 %asmresult10, i32* %__edx, align 4
354 return: ; preds = %if.end, %if.then
355 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
359 declare void @exit(i32) noreturn
361 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
363 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
364 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
365 %tobool = icmp eq i32* %__sig, null
366 br i1 %tobool, label %if.end, label %if.then
368 if.then: ; preds = %entry
369 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
370 store i32 %asmresult1, i32* %__sig, align 4
373 if.end: ; preds = %entry, %if.then
377 !0 = metadata !{i32 -2147342488, i32 -2147342480}
378 !1 = metadata !{i32 -2147342611, i32 -2147342603}