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-66.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-66.s > vect-66.ll
6 ; ModuleID = 'vect-66.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 define void @main1() nounwind uwtable noinline {
12 %ia = alloca [8 x [5 x [18 x i32]]], align 16
15 for.cond: ; preds = %for.inc9, %entry
16 %tmp = phi i32 [ 0, %entry ], [ %inc11, %for.inc9 ]
17 %exitcond3 = icmp ne i32 %tmp, 16
18 br i1 %exitcond3, label %for.body, label %for.end12
20 for.body: ; preds = %for.cond
23 for.cond1: ; preds = %for.inc, %for.body
24 %indvar1 = phi i64 [ %indvar.next2, %for.inc ], [ 0, %for.body ]
25 %arrayidx7 = getelementptr [8 x [5 x [18 x i32]]]* %ia, i64 0, i64 3, i64 1, i64 %indvar1
26 %exitcond = icmp ne i64 %indvar1, 16
27 br i1 %exitcond, label %for.body4, label %for.end
29 for.body4: ; preds = %for.cond1
30 store i32 5, i32* %arrayidx7, align 4
33 for.inc: ; preds = %for.body4
34 %indvar.next2 = add i64 %indvar1, 1
37 for.end: ; preds = %for.cond1
40 for.inc9: ; preds = %for.end
41 %inc11 = add nsw i32 %tmp, 1
44 for.end12: ; preds = %for.cond
47 for.cond13: ; preds = %for.inc32, %for.end12
48 %tmp4 = phi i32 [ 0, %for.end12 ], [ %inc34, %for.inc32 ]
49 %cmp15 = icmp slt i32 %tmp4, 16
50 br i1 %cmp15, label %for.body16, label %for.end35
52 for.body16: ; preds = %for.cond13
55 for.cond17: ; preds = %for.inc28, %for.body16
56 %indvar = phi i64 [ %indvar.next, %for.inc28 ], [ 0, %for.body16 ]
57 %arrayidx25 = getelementptr [8 x [5 x [18 x i32]]]* %ia, i64 0, i64 3, i64 1, i64 %indvar
58 %j.1 = trunc i64 %indvar to i32
59 %cmp19 = icmp slt i32 %j.1, 16
60 br i1 %cmp19, label %for.body20, label %for.end31
62 for.body20: ; preds = %for.cond17
63 %tmp26 = load i32* %arrayidx25, align 4
64 %cmp27 = icmp eq i32 %tmp26, 5
65 br i1 %cmp27, label %if.end, label %if.then
67 if.then: ; preds = %for.body20
68 call void @abort() noreturn nounwind
71 if.end: ; preds = %for.body20
74 for.inc28: ; preds = %if.end
75 %indvar.next = add i64 %indvar, 1
78 for.end31: ; preds = %for.cond17
81 for.inc32: ; preds = %for.end31
82 %inc34 = add nsw i32 %tmp4, 1
85 for.end35: ; preds = %for.cond13
89 declare void @abort() noreturn
91 define void @main2() nounwind uwtable noinline {
93 %ia = alloca [8 x [5 x [18 x i32]]], align 16
96 for.cond: ; preds = %for.inc9, %entry
97 %tmp7 = phi i32 [ 0, %entry ], [ %inc11, %for.inc9 ]
98 %exitcond6 = icmp ne i32 %tmp7, 16
99 br i1 %exitcond6, label %for.body, label %for.end12
101 for.body: ; preds = %for.cond
104 for.cond1: ; preds = %for.inc, %for.body
105 %indvar2 = phi i64 [ %indvar.next3, %for.inc ], [ 0, %for.body ]
106 %tmp4 = add i64 %indvar2, 2
107 %arrayidx7 = getelementptr [8 x [5 x [18 x i32]]]* %ia, i64 0, i64 4, i64 1, i64 %tmp4
108 %exitcond = icmp ne i64 %indvar2, 16
109 br i1 %exitcond, label %for.body4, label %for.end
111 for.body4: ; preds = %for.cond1
112 store i32 5, i32* %arrayidx7, align 4
115 for.inc: ; preds = %for.body4
116 %indvar.next3 = add i64 %indvar2, 1
119 for.end: ; preds = %for.cond1
122 for.inc9: ; preds = %for.end
123 %inc11 = add nsw i32 %tmp7, 1
126 for.end12: ; preds = %for.cond
129 for.cond13: ; preds = %for.inc32, %for.end12
130 %tmp8 = phi i32 [ 0, %for.end12 ], [ %inc34, %for.inc32 ]
131 %cmp15 = icmp slt i32 %tmp8, 16
132 br i1 %cmp15, label %for.body16, label %for.end35
134 for.body16: ; preds = %for.cond13
137 for.cond17: ; preds = %for.inc28, %for.body16
138 %indvar = phi i64 [ %indvar.next, %for.inc28 ], [ 0, %for.body16 ]
139 %tmp = add i64 %indvar, 2
140 %arrayidx25 = getelementptr [8 x [5 x [18 x i32]]]* %ia, i64 0, i64 4, i64 1, i64 %tmp
141 %j.1 = trunc i64 %tmp to i32
142 %cmp19 = icmp slt i32 %j.1, 18
143 br i1 %cmp19, label %for.body20, label %for.end31
145 for.body20: ; preds = %for.cond17
146 %tmp26 = load i32* %arrayidx25, align 4
147 %cmp27 = icmp eq i32 %tmp26, 5
148 br i1 %cmp27, label %if.end, label %if.then
150 if.then: ; preds = %for.body20
151 call void @abort() noreturn nounwind
154 if.end: ; preds = %for.body20
157 for.inc28: ; preds = %if.end
158 %indvar.next = add i64 %indvar, 1
161 for.end31: ; preds = %for.cond17
164 for.inc32: ; preds = %for.end31
165 %inc34 = add nsw i32 %tmp8, 1
168 for.end35: ; preds = %for.cond13
172 define void @main3() nounwind uwtable noinline {
174 %ic = alloca [16 x [16 x [5 x [18 x i32]]]], align 16
177 for.cond: ; preds = %for.inc10, %entry
178 %tmp7 = phi i32 [ 0, %entry ], [ %inc12, %for.inc10 ]
179 %exitcond6 = icmp ne i32 %tmp7, 16
180 br i1 %exitcond6, label %for.body, label %for.end13
182 for.body: ; preds = %for.cond
185 for.cond1: ; preds = %for.inc, %for.body
186 %indvar2 = phi i64 [ %indvar.next3, %for.inc ], [ 0, %for.body ]
187 %tmp4 = add i64 %indvar2, 1
188 %arrayidx8 = getelementptr [16 x [16 x [5 x [18 x i32]]]]* %ic, i64 0, i64 2, i64 2, i64 1, i64 %tmp4
189 %exitcond = icmp ne i64 %indvar2, 16
190 br i1 %exitcond, label %for.body4, label %for.end
192 for.body4: ; preds = %for.cond1
193 store i32 5, i32* %arrayidx8, align 4
196 for.inc: ; preds = %for.body4
197 %indvar.next3 = add i64 %indvar2, 1
200 for.end: ; preds = %for.cond1
203 for.inc10: ; preds = %for.end
204 %inc12 = add nsw i32 %tmp7, 1
207 for.end13: ; preds = %for.cond
210 for.cond14: ; preds = %for.inc35, %for.end13
211 %tmp8 = phi i32 [ 0, %for.end13 ], [ %inc37, %for.inc35 ]
212 %cmp16 = icmp slt i32 %tmp8, 16
213 br i1 %cmp16, label %for.body17, label %for.end38
215 for.body17: ; preds = %for.cond14
218 for.cond18: ; preds = %for.inc31, %for.body17
219 %indvar = phi i64 [ %indvar.next, %for.inc31 ], [ 0, %for.body17 ]
220 %tmp = add i64 %indvar, 1
221 %arrayidx28 = getelementptr [16 x [16 x [5 x [18 x i32]]]]* %ic, i64 0, i64 2, i64 2, i64 1, i64 %tmp
222 %j.1 = trunc i64 %indvar to i32
223 %cmp20 = icmp slt i32 %j.1, 16
224 br i1 %cmp20, label %for.body21, label %for.end34
226 for.body21: ; preds = %for.cond18
227 %tmp29 = load i32* %arrayidx28, align 4
228 %cmp30 = icmp eq i32 %tmp29, 5
229 br i1 %cmp30, label %if.end, label %if.then
231 if.then: ; preds = %for.body21
232 call void @abort() noreturn nounwind
235 if.end: ; preds = %for.body21
238 for.inc31: ; preds = %if.end
239 %indvar.next = add i64 %indvar, 1
242 for.end34: ; preds = %for.cond18
245 for.inc35: ; preds = %for.end34
246 %inc37 = add nsw i32 %tmp8, 1
249 for.end38: ; preds = %for.cond14
253 define i32 @main() nounwind uwtable {
255 call void @check_vect()
262 define internal void @check_vect() nounwind uwtable noinline {
264 %a = alloca i32, align 4
265 %b = alloca i32, align 4
266 %c = alloca i32, align 4
267 %d = alloca i32, align 4
268 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
269 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
270 %tobool = icmp eq i32 %call1, 0
271 br i1 %tobool, label %if.then, label %lor.lhs.false
273 lor.lhs.false: ; preds = %entry
274 %tmp4 = load i32* %d, align 4
275 %and6 = and i32 %tmp4, 67108864
276 %cmp = icmp eq i32 %and6, 0
277 br i1 %cmp, label %if.then, label %if.end
279 if.then: ; preds = %entry, %lor.lhs.false
280 call void @exit(i32 0) noreturn nounwind
283 if.end: ; preds = %lor.lhs.false
284 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
288 declare void (i32)* @signal(i32, void (i32)*) nounwind
290 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
292 call void @exit(i32 0) noreturn nounwind
295 return: ; No predecessors!
299 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
301 %and = and i32 %__level, -2147483648
302 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
303 %cmp = icmp ult i32 %call, %__level
304 br i1 %cmp, label %if.then, label %if.end
306 if.then: ; preds = %entry
309 if.end: ; preds = %entry
310 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
311 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
312 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
313 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
314 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
315 store i32 %asmresult, i32* %__eax, align 4
316 store i32 %asmresult8, i32* %__ebx, align 4
317 store i32 %asmresult9, i32* %__ecx, align 4
318 store i32 %asmresult10, i32* %__edx, align 4
321 return: ; preds = %if.end, %if.then
322 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
326 declare void @exit(i32) noreturn
328 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
330 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
331 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
332 %tobool = icmp eq i32* %__sig, null
333 br i1 %tobool, label %if.end, label %if.then
335 if.then: ; preds = %entry
336 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
337 store i32 %asmresult1, i32* %__sig, align 4
340 if.end: ; preds = %entry, %if.then
344 !0 = metadata !{i32 -2147342769, i32 -2147342761}
345 !1 = metadata !{i32 -2147342892, i32 -2147342884}