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-64.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-64.s > vect-64.ll
6 ; ModuleID = 'vect-64.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 @ib = global [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], align 16
12 define i32 @main1() nounwind uwtable noinline {
14 %ia = alloca [16 x [4 x [17 x i32]]], align 16
15 %ic = alloca [16 x [16 x [3 x [17 x i32]]]], align 16
16 %id = alloca [16 x [16 x [17 x i32]]], align 16
19 for.cond: ; preds = %for.inc15, %entry
20 %indvar31 = phi i64 [ %indvar.next32, %for.inc15 ], [ 0, %entry ]
21 %arrayidx = getelementptr [16 x i32]* @ib, i64 0, i64 %indvar31
22 %exitcond33 = icmp ne i64 %indvar31, 16
23 br i1 %exitcond33, label %for.body, label %for.end18
25 for.body: ; preds = %for.cond
28 for.cond1: ; preds = %for.inc, %for.body
29 %indvar28 = phi i64 [ %indvar.next29, %for.inc ], [ 0, %for.body ]
30 %arrayidx13 = getelementptr [16 x [4 x [17 x i32]]]* %ia, i64 0, i64 %indvar31, i64 1, i64 %indvar28
31 %exitcond30 = icmp ne i64 %indvar28, 16
32 br i1 %exitcond30, label %for.body4, label %for.end
34 for.body4: ; preds = %for.cond1
35 %tmp6 = load i32* %arrayidx, align 4
36 store i32 %tmp6, i32* %arrayidx13, align 4
39 for.inc: ; preds = %for.body4
40 %indvar.next29 = add i64 %indvar28, 1
43 for.end: ; preds = %for.cond1
46 for.inc15: ; preds = %for.end
47 %indvar.next32 = add i64 %indvar31, 1
50 for.end18: ; preds = %for.cond
53 for.cond19: ; preds = %for.inc43, %for.end18
54 %indvar25 = phi i64 [ %indvar.next26, %for.inc43 ], [ 0, %for.end18 ]
55 %arrayidx29 = getelementptr [16 x i32]* @ib, i64 0, i64 %indvar25
56 %exitcond27 = icmp ne i64 %indvar25, 16
57 br i1 %exitcond27, label %for.body22, label %for.end46
59 for.body22: ; preds = %for.cond19
62 for.cond23: ; preds = %for.inc39, %for.body22
63 %indvar22 = phi i64 [ %indvar.next23, %for.inc39 ], [ 0, %for.body22 ]
64 %arrayidx38 = getelementptr [16 x [16 x [3 x [17 x i32]]]]* %ic, i64 0, i64 %indvar25, i64 1, i64 1, i64 %indvar22
65 %exitcond24 = icmp ne i64 %indvar22, 16
66 br i1 %exitcond24, label %for.body26, label %for.end42
68 for.body26: ; preds = %for.cond23
69 %tmp30 = load i32* %arrayidx29, align 4
70 store i32 %tmp30, i32* %arrayidx38, align 4
73 for.inc39: ; preds = %for.body26
74 %indvar.next23 = add i64 %indvar22, 1
77 for.end42: ; preds = %for.cond23
80 for.inc43: ; preds = %for.end42
81 %indvar.next26 = add i64 %indvar25, 1
84 for.end46: ; preds = %for.cond19
87 for.cond47: ; preds = %for.inc70, %for.end46
88 %indvar16 = phi i64 [ %indvar.next17, %for.inc70 ], [ 0, %for.end46 ]
89 %arrayidx57 = getelementptr [16 x i32]* @ib, i64 0, i64 %indvar16
90 %exitcond19 = icmp ne i64 %indvar16, 16
91 br i1 %exitcond19, label %for.body50, label %for.end73
93 for.body50: ; preds = %for.cond47
96 for.cond51: ; preds = %for.inc66, %for.body50
97 %indvar14 = phi i64 [ %indvar.next15, %for.inc66 ], [ 0, %for.body50 ]
98 %tmp20 = add i64 %indvar14, 1
99 %arrayidx65 = getelementptr [16 x [16 x [17 x i32]]]* %id, i64 0, i64 %indvar16, i64 1, i64 %tmp20
100 %exitcond = icmp ne i64 %indvar14, 16
101 br i1 %exitcond, label %for.body54, label %for.end69
103 for.body54: ; preds = %for.cond51
104 %tmp58 = load i32* %arrayidx57, align 4
105 store i32 %tmp58, i32* %arrayidx65, align 4
108 for.inc66: ; preds = %for.body54
109 %indvar.next15 = add i64 %indvar14, 1
112 for.end69: ; preds = %for.cond51
115 for.inc70: ; preds = %for.end69
116 %indvar.next17 = add i64 %indvar16, 1
119 for.end73: ; preds = %for.cond47
122 for.cond74: ; preds = %for.inc99, %for.end73
123 %indvar12 = phi i64 [ %indvar.next13, %for.inc99 ], [ 0, %for.end73 ]
124 %arrayidx92 = getelementptr [16 x i32]* @ib, i64 0, i64 %indvar12
125 %i.3 = trunc i64 %indvar12 to i32
126 %cmp76 = icmp slt i32 %i.3, 16
127 br i1 %cmp76, label %for.body77, label %for.end102
129 for.body77: ; preds = %for.cond74
132 for.cond78: ; preds = %for.inc95, %for.body77
133 %indvar10 = phi i64 [ %indvar.next11, %for.inc95 ], [ 0, %for.body77 ]
134 %arrayidx88 = getelementptr [16 x [4 x [17 x i32]]]* %ia, i64 0, i64 %indvar12, i64 1, i64 %indvar10
135 %j.3 = trunc i64 %indvar10 to i32
136 %cmp80 = icmp slt i32 %j.3, 16
137 br i1 %cmp80, label %for.body81, label %for.end98
139 for.body81: ; preds = %for.cond78
140 %tmp89 = load i32* %arrayidx88, align 4
141 %tmp93 = load i32* %arrayidx92, align 4
142 %cmp94 = icmp eq i32 %tmp89, %tmp93
143 br i1 %cmp94, label %if.end, label %if.then
145 if.then: ; preds = %for.body81
146 call void @abort() noreturn nounwind
149 if.end: ; preds = %for.body81
152 for.inc95: ; preds = %if.end
153 %indvar.next11 = add i64 %indvar10, 1
156 for.end98: ; preds = %for.cond78
159 for.inc99: ; preds = %for.end98
160 %indvar.next13 = add i64 %indvar12, 1
163 for.end102: ; preds = %for.cond74
164 br label %for.cond103
166 for.cond103: ; preds = %for.inc131, %for.end102
167 %indvar8 = phi i64 [ %indvar.next9, %for.inc131 ], [ 0, %for.end102 ]
168 %arrayidx122 = getelementptr [16 x i32]* @ib, i64 0, i64 %indvar8
169 %i.4 = trunc i64 %indvar8 to i32
170 %cmp105 = icmp slt i32 %i.4, 16
171 br i1 %cmp105, label %for.body106, label %for.end134
173 for.body106: ; preds = %for.cond103
174 br label %for.cond107
176 for.cond107: ; preds = %for.inc127, %for.body106
177 %indvar6 = phi i64 [ %indvar.next7, %for.inc127 ], [ 0, %for.body106 ]
178 %arrayidx118 = getelementptr [16 x [16 x [3 x [17 x i32]]]]* %ic, i64 0, i64 %indvar8, i64 1, i64 1, i64 %indvar6
179 %j.4 = trunc i64 %indvar6 to i32
180 %cmp109 = icmp slt i32 %j.4, 16
181 br i1 %cmp109, label %for.body110, label %for.end130
183 for.body110: ; preds = %for.cond107
184 %tmp119 = load i32* %arrayidx118, align 4
185 %tmp123 = load i32* %arrayidx122, align 4
186 %cmp124 = icmp eq i32 %tmp119, %tmp123
187 br i1 %cmp124, label %if.end126, label %if.then125
189 if.then125: ; preds = %for.body110
190 call void @abort() noreturn nounwind
193 if.end126: ; preds = %for.body110
196 for.inc127: ; preds = %if.end126
197 %indvar.next7 = add i64 %indvar6, 1
198 br label %for.cond107
200 for.end130: ; preds = %for.cond107
203 for.inc131: ; preds = %for.end130
204 %indvar.next9 = add i64 %indvar8, 1
205 br label %for.cond103
207 for.end134: ; preds = %for.cond103
208 br label %for.cond135
210 for.cond135: ; preds = %for.inc163, %for.end134
211 %indvar1 = phi i64 [ %indvar.next2, %for.inc163 ], [ 0, %for.end134 ]
212 %arrayidx154 = getelementptr [16 x i32]* @ib, i64 0, i64 %indvar1
213 %i.5 = trunc i64 %indvar1 to i32
214 %cmp137 = icmp slt i32 %i.5, 16
215 br i1 %cmp137, label %for.body138, label %for.end166
217 for.body138: ; preds = %for.cond135
218 br label %for.cond139
220 for.cond139: ; preds = %for.inc159, %for.body138
221 %indvar = phi i64 [ %indvar.next, %for.inc159 ], [ 0, %for.body138 ]
222 %tmp4 = add i64 %indvar, 1
223 %arrayidx150 = getelementptr [16 x [16 x [17 x i32]]]* %id, i64 0, i64 %indvar1, i64 1, i64 %tmp4
224 %j.5 = trunc i64 %indvar to i32
225 %cmp141 = icmp slt i32 %j.5, 16
226 br i1 %cmp141, label %for.body142, label %for.end162
228 for.body142: ; preds = %for.cond139
229 %tmp151 = load i32* %arrayidx150, align 4
230 %tmp155 = load i32* %arrayidx154, align 4
231 %cmp156 = icmp eq i32 %tmp151, %tmp155
232 br i1 %cmp156, label %if.end158, label %if.then157
234 if.then157: ; preds = %for.body142
235 call void @abort() noreturn nounwind
238 if.end158: ; preds = %for.body142
241 for.inc159: ; preds = %if.end158
242 %indvar.next = add i64 %indvar, 1
243 br label %for.cond139
245 for.end162: ; preds = %for.cond139
248 for.inc163: ; preds = %for.end162
249 %indvar.next2 = add i64 %indvar1, 1
250 br label %for.cond135
252 for.end166: ; preds = %for.cond135
256 declare void @abort() noreturn
258 define i32 @main() nounwind uwtable {
260 call void @check_vect()
261 %call = call i32 @main1()
265 define internal void @check_vect() nounwind uwtable noinline {
267 %a = alloca i32, align 4
268 %b = alloca i32, align 4
269 %c = alloca i32, align 4
270 %d = alloca i32, align 4
271 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
272 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
273 %tobool = icmp eq i32 %call1, 0
274 br i1 %tobool, label %if.then, label %lor.lhs.false
276 lor.lhs.false: ; preds = %entry
277 %tmp4 = load i32* %d, align 4
278 %and6 = and i32 %tmp4, 67108864
279 %cmp = icmp eq i32 %and6, 0
280 br i1 %cmp, label %if.then, label %if.end
282 if.then: ; preds = %entry, %lor.lhs.false
283 call void @exit(i32 0) noreturn nounwind
286 if.end: ; preds = %lor.lhs.false
287 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
291 declare void (i32)* @signal(i32, void (i32)*) nounwind
293 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
295 call void @exit(i32 0) noreturn nounwind
298 return: ; No predecessors!
302 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
304 %and = and i32 %__level, -2147483648
305 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
306 %cmp = icmp ult i32 %call, %__level
307 br i1 %cmp, label %if.then, label %if.end
309 if.then: ; preds = %entry
312 if.end: ; preds = %entry
313 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
314 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
315 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
316 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
317 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
318 store i32 %asmresult, i32* %__eax, align 4
319 store i32 %asmresult8, i32* %__ebx, align 4
320 store i32 %asmresult9, i32* %__ecx, align 4
321 store i32 %asmresult10, i32* %__edx, align 4
324 return: ; preds = %if.end, %if.then
325 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
329 declare void @exit(i32) noreturn
331 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
333 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
334 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
335 %tobool = icmp eq i32* %__sig, null
336 br i1 %tobool, label %if.end, label %if.then
338 if.then: ; preds = %entry
339 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
340 store i32 %asmresult1, i32* %__sig, align 4
343 if.end: ; preds = %entry, %if.then
347 !0 = metadata !{i32 -2147342771, i32 -2147342763}
348 !1 = metadata !{i32 -2147342894, i32 -2147342886}