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-a-u8-i8-gap2.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-strided-a-u8-i8-gap2.s > vect-strided-a-u8-i8-gap2.ll
6 ; ModuleID = 'vect-strided-a-u8-i8-gap2.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() nounwind uwtable noinline {
14 %arr = alloca [16 x %struct.s], align 16
15 %res = alloca [16 x %struct.s], align 16
18 for.cond: ; preds = %for.inc, %entry
19 %indvar26 = phi i64 [ %indvar.next27, %for.inc ], [ 0, %entry ]
20 %tmp = add i64 %indvar26, -3
21 %conv30 = trunc i64 %tmp to i8
22 %tmp29 = mul i64 %indvar26, 2
23 %tmp30 = add i64 %tmp29, 2
24 %conv25 = trunc i64 %tmp30 to i8
25 %conv4 = trunc i64 %tmp29 to i8
26 %scevgep33 = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar26
27 %a = bitcast %struct.s* %scevgep33 to i8*
28 %h = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar26, i32 7
29 %g = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar26, i32 6
30 %f = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar26, i32 5
31 %e = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar26, i32 4
32 %tmp39 = add i64 %indvar26, 5
33 %conv18 = trunc i64 %tmp39 to i8
34 %d = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar26, i32 3
35 %tmp42 = add i64 %indvar26, 34
36 %conv12 = trunc i64 %tmp42 to i8
37 %c = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar26, i32 2
38 %b = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar26, i32 1
39 %conv = trunc i64 %indvar26 to i8
40 %i.0 = trunc i64 %indvar26 to i32
41 %cmp = icmp slt i32 %i.0, 16
42 br i1 %cmp, label %for.body, label %for.end
44 for.body: ; preds = %for.cond
45 store i8 %conv, i8* %a, align 8
46 store i8 %conv4, i8* %b, align 1
47 store i8 17, i8* %c, align 2
48 store i8 %conv12, i8* %d, align 1
49 store i8 %conv18, i8* %e, align 4
50 store i8 %conv25, i8* %f, align 1
51 store i8 %conv30, i8* %g, align 2
52 store i8 56, i8* %h, align 1
53 %tmp41 = load i8* %a, align 8
54 %cmp43 = icmp eq i8 %tmp41, -78
55 br i1 %cmp43, label %if.then, label %if.end
57 if.then: ; preds = %for.body
58 call void @abort() noreturn nounwind
61 if.end: ; preds = %for.body
64 for.inc: ; preds = %if.end
65 %indvar.next27 = add i64 %indvar26, 1
68 for.end: ; preds = %for.cond
71 for.cond46: ; preds = %for.inc136, %for.end
72 %indvar12 = phi i64 [ %indvar.next13, %for.inc136 ], [ 0, %for.end ]
73 %g134 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar12, i32 6
74 %h120 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar12, i32 7
75 %e113 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar12, i32 4
76 %f99 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar12, i32 5
77 %b92 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar12, i32 1
78 %d85 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar12, i32 3
79 %scevgep20 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar12
80 %a71 = bitcast %struct.s* %scevgep20 to i8*
81 %c57 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar12, i32 2
82 %scevgep23 = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar12
83 %a52 = bitcast %struct.s* %scevgep23 to i8*
84 %f59 = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar12, i32 5
85 %exitcond = icmp ne i64 %indvar12, 16
86 br i1 %exitcond, label %for.body50, label %for.end139
88 for.body50: ; preds = %for.cond46
89 %tmp53 = load i8* %a52, align 1
90 store i8 %tmp53, i8* %c57, align 2
91 %tmp60 = load i8* %f59, align 1
92 %tmp64 = load i8* %a52, align 1
93 %add66 = add i8 %tmp60, %tmp64
94 store i8 %add66, i8* %a71, align 8
95 %tmp74 = load i8* %f59, align 1
96 %tmp78 = load i8* %a52, align 1
97 %sub80 = sub i8 %tmp74, %tmp78
98 store i8 %sub80, i8* %d85, align 1
99 %tmp88 = load i8* %f59, align 1
100 store i8 %tmp88, i8* %b92, align 1
101 %tmp95 = load i8* %a52, align 1
102 store i8 %tmp95, i8* %f99, align 1
103 %tmp102 = load i8* %f59, align 1
104 %tmp106 = load i8* %a52, align 1
105 %sub108 = sub i8 %tmp102, %tmp106
106 store i8 %sub108, i8* %e113, align 4
107 %tmp116 = load i8* %f59, align 1
108 store i8 %tmp116, i8* %h120, align 1
109 %tmp123 = load i8* %f59, align 1
110 %tmp127 = load i8* %a52, align 1
111 %sub129 = sub i8 %tmp123, %tmp127
112 store i8 %sub129, i8* %g134, align 2
115 for.inc136: ; preds = %for.body50
116 %indvar.next13 = add i64 %indvar12, 1
119 for.end139: ; preds = %for.cond46
120 br label %for.cond140
122 for.cond140: ; preds = %for.inc293, %for.end139
123 %indvar = phi i64 [ %indvar.next, %for.inc293 ], [ 0, %for.end139 ]
124 %scevgep = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar
125 %a154 = bitcast %struct.s* %scevgep to i8*
126 %f168 = getelementptr [16 x %struct.s]* %arr, i64 0, i64 %indvar, i32 5
127 %g273 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 6
128 %h258 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 7
129 %e236 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 4
130 %f221 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 5
131 %b206 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 1
132 %d184 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 3
133 %scevgep9 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar
134 %a162 = bitcast %struct.s* %scevgep9 to i8*
135 %c148 = getelementptr [16 x %struct.s]* %res, i64 0, i64 %indvar, i32 2
136 %i.2 = trunc i64 %indvar to i32
137 %cmp142 = icmp slt i32 %i.2, 16
138 br i1 %cmp142, label %for.body144, label %for.end296
140 for.body144: ; preds = %for.cond140
141 %tmp149 = load i8* %c148, align 2
142 %tmp155 = load i8* %a154, align 8
143 %cmp157 = icmp eq i8 %tmp149, %tmp155
144 br i1 %cmp157, label %lor.lhs.false, label %if.then291
146 lor.lhs.false: ; preds = %for.body144
147 %tmp163 = load i8* %a162, align 8
148 %conv164 = zext i8 %tmp163 to i32
149 %tmp169 = load i8* %f168, align 1
150 %conv170 = zext i8 %tmp169 to i32
151 %tmp175 = load i8* %a154, align 8
152 %conv176 = zext i8 %tmp175 to i32
153 %add177 = add nsw i32 %conv170, %conv176
154 %cmp178 = icmp eq i32 %conv164, %add177
155 br i1 %cmp178, label %lor.lhs.false180, label %if.then291
157 lor.lhs.false180: ; preds = %lor.lhs.false
158 %tmp185 = load i8* %d184, align 1
159 %conv186 = zext i8 %tmp185 to i32
160 %tmp191 = load i8* %f168, align 1
161 %conv192 = zext i8 %tmp191 to i32
162 %tmp197 = load i8* %a154, align 8
163 %conv198 = zext i8 %tmp197 to i32
164 %sub199 = sub nsw i32 %conv192, %conv198
165 %cmp200 = icmp eq i32 %conv186, %sub199
166 br i1 %cmp200, label %lor.lhs.false202, label %if.then291
168 lor.lhs.false202: ; preds = %lor.lhs.false180
169 %tmp207 = load i8* %b206, align 1
170 %tmp213 = load i8* %f168, align 1
171 %cmp215 = icmp eq i8 %tmp207, %tmp213
172 br i1 %cmp215, label %lor.lhs.false217, label %if.then291
174 lor.lhs.false217: ; preds = %lor.lhs.false202
175 %tmp222 = load i8* %f221, align 1
176 %tmp228 = load i8* %a154, align 8
177 %cmp230 = icmp eq i8 %tmp222, %tmp228
178 br i1 %cmp230, label %lor.lhs.false232, label %if.then291
180 lor.lhs.false232: ; preds = %lor.lhs.false217
181 %tmp237 = load i8* %e236, align 4
182 %conv238 = zext i8 %tmp237 to i32
183 %tmp243 = load i8* %f168, align 1
184 %conv244 = zext i8 %tmp243 to i32
185 %tmp249 = load i8* %a154, align 8
186 %conv250 = zext i8 %tmp249 to i32
187 %sub251 = sub nsw i32 %conv244, %conv250
188 %cmp252 = icmp eq i32 %conv238, %sub251
189 br i1 %cmp252, label %lor.lhs.false254, label %if.then291
191 lor.lhs.false254: ; preds = %lor.lhs.false232
192 %tmp259 = load i8* %h258, align 1
193 %tmp265 = load i8* %f168, align 1
194 %cmp267 = icmp eq i8 %tmp259, %tmp265
195 br i1 %cmp267, label %lor.lhs.false269, label %if.then291
197 lor.lhs.false269: ; preds = %lor.lhs.false254
198 %tmp274 = load i8* %g273, align 2
199 %conv275 = zext i8 %tmp274 to i32
200 %tmp280 = load i8* %f168, align 1
201 %conv281 = zext i8 %tmp280 to i32
202 %tmp286 = load i8* %a154, align 8
203 %conv287 = zext i8 %tmp286 to i32
204 %sub288 = sub nsw i32 %conv281, %conv287
205 %cmp289 = icmp eq i32 %conv275, %sub288
206 br i1 %cmp289, label %if.end292, label %if.then291
208 if.then291: ; preds = %lor.lhs.false269, %lor.lhs.false254, %lor.lhs.false232, %lor.lhs.false217, %lor.lhs.false202, %lor.lhs.false180, %lor.lhs.false, %for.body144
209 call void @abort() noreturn nounwind
212 if.end292: ; preds = %lor.lhs.false269
215 for.inc293: ; preds = %if.end292
216 %indvar.next = add i64 %indvar, 1
217 br label %for.cond140
219 for.end296: ; preds = %for.cond140
223 declare void @abort() noreturn
225 define i32 @main() nounwind uwtable {
227 call void @check_vect()
228 %call = call i32 @main1()
232 define internal void @check_vect() nounwind uwtable noinline {
234 %a = alloca i32, align 4
235 %b = alloca i32, align 4
236 %c = alloca i32, align 4
237 %d = alloca i32, align 4
238 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
239 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
240 %tobool = icmp eq i32 %call1, 0
241 br i1 %tobool, label %if.then, label %lor.lhs.false
243 lor.lhs.false: ; preds = %entry
244 %tmp4 = load i32* %d, align 4
245 %and6 = and i32 %tmp4, 67108864
246 %cmp = icmp eq i32 %and6, 0
247 br i1 %cmp, label %if.then, label %if.end
249 if.then: ; preds = %entry, %lor.lhs.false
250 call void @exit(i32 0) noreturn nounwind
253 if.end: ; preds = %lor.lhs.false
254 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
258 declare void (i32)* @signal(i32, void (i32)*) nounwind
260 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
262 call void @exit(i32 0) noreturn nounwind
265 return: ; No predecessors!
269 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
271 %and = and i32 %__level, -2147483648
272 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
273 %cmp = icmp ult i32 %call, %__level
274 br i1 %cmp, label %if.then, label %if.end
276 if.then: ; preds = %entry
279 if.end: ; preds = %entry
280 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
281 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
282 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
283 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
284 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
285 store i32 %asmresult, i32* %__eax, align 4
286 store i32 %asmresult8, i32* %__ebx, align 4
287 store i32 %asmresult9, i32* %__ecx, align 4
288 store i32 %asmresult10, i32* %__edx, align 4
291 return: ; preds = %if.end, %if.then
292 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
296 declare void @exit(i32) noreturn
298 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
300 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
301 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
302 %tobool = icmp eq i32* %__sig, null
303 br i1 %tobool, label %if.end, label %if.then
305 if.then: ; preds = %entry
306 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
307 store i32 %asmresult1, i32* %__sig, align 4
310 if.end: ; preds = %entry, %if.then
314 !0 = metadata !{i32 -2147342761, i32 -2147342753}
315 !1 = metadata !{i32 -2147342884, i32 -2147342876}