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-28.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer slp-28.s > slp-28.ll
6 ; ModuleID = 'slp-28.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 @in = global [32 x i16] [i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19, i16 20, i16 21, i16 22, i16 23, i16 24, i16 25, i16 26, i16 27, i16 28, i16 29, i16 30, i16 31], align 16
11 @in2 = global [32 x i16] [i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19, i16 20, i16 21, i16 22, i16 23, i16 24, i16 25, i16 26, i16 27, i16 28, i16 29, i16 30, i16 31], align 16
12 @in3 = global [32 x i16] [i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17, i16 18, i16 19, i16 20, i16 21, i16 22, i16 23, i16 24, i16 25, i16 26, i16 27, i16 28, i16 29, i16 30, i16 31], align 16
13 @check = global [32 x i16] [i16 0, i16 1, i16 2, i16 3, i16 5, i16 6, i16 7, i16 8, i16 10, i16 11, i16 12, i16 13, i16 15, i16 16, i16 17, i16 18, i16 20, i16 21, i16 22, i16 23, i16 25, i16 26, i16 27, i16 28, i16 30, i16 31, i16 32, i16 33, i16 35, i16 36, i16 37, i16 38], align 16
14 @check3 = global [32 x i16] [i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15, i16 16, i16 17], align 16
16 define i32 @main1() nounwind uwtable {
20 for.cond: ; preds = %for.inc, %entry
21 %indvar50 = phi i64 [ %indvar.next51, %for.inc ], [ 0, %entry ]
22 %tmp53 = mul i64 %indvar50, 4
23 %tmp54 = add i64 %tmp53, 3
24 %arrayidx40 = getelementptr [32 x i16]* @in, i64 0, i64 %tmp54
25 %tmp55 = add i64 %tmp53, 2
26 %arrayidx26 = getelementptr [32 x i16]* @in, i64 0, i64 %tmp55
27 %tmp56 = add i64 %tmp53, 1
28 %arrayidx12 = getelementptr [32 x i16]* @in, i64 0, i64 %tmp56
29 %arrayidx = getelementptr [32 x i16]* @in, i64 0, i64 %tmp53
30 %exitcond52 = icmp ne i64 %indvar50, 8
31 br i1 %exitcond52, label %for.body, label %for.end
33 for.body: ; preds = %for.cond
34 %tmp2 = load i16* %arrayidx, align 8
35 %add = add i16 %tmp2, 5
36 store i16 %add, i16* %arrayidx, align 8
37 %tmp13 = load i16* %arrayidx12, align 2
38 %add15 = add i16 %tmp13, 5
39 store i16 %add15, i16* %arrayidx12, align 2
40 %tmp27 = load i16* %arrayidx26, align 4
41 %add29 = add i16 %tmp27, 5
42 store i16 %add29, i16* %arrayidx26, align 4
43 %tmp41 = load i16* %arrayidx40, align 2
44 %add43 = add i16 %tmp41, 5
45 store i16 %add43, i16* %arrayidx40, align 2
48 for.inc: ; preds = %for.body
49 %indvar.next51 = add i64 %indvar50, 1
52 for.end: ; preds = %for.cond
55 for.cond51: ; preds = %for.inc65, %for.end
56 %indvar45 = phi i64 [ %indvar.next46, %for.inc65 ], [ 0, %for.end ]
57 %tmp47 = add i64 %indvar45, 5
58 %add62 = trunc i64 %tmp47 to i32
59 %arrayidx58 = getelementptr [32 x i16]* @in, i64 0, i64 %indvar45
60 %i.1 = trunc i64 %indvar45 to i32
61 %cmp53 = icmp slt i32 %i.1, 32
62 br i1 %cmp53, label %for.body55, label %for.end68
64 for.body55: ; preds = %for.cond51
65 %tmp59 = load i16* %arrayidx58, align 2
66 %conv60 = zext i16 %tmp59 to i32
67 %cmp63 = icmp eq i32 %conv60, %add62
68 br i1 %cmp63, label %if.end, label %if.then
70 if.then: ; preds = %for.body55
71 call void @abort() noreturn nounwind
74 if.end: ; preds = %for.body55
77 for.inc65: ; preds = %if.end
78 %indvar.next46 = add i64 %indvar45, 1
81 for.end68: ; preds = %for.cond51
84 for.cond69: ; preds = %for.inc131, %for.end68
85 %indvar31 = phi i64 [ %indvar.next32, %for.inc131 ], [ 0, %for.end68 ]
86 %tmp34 = mul i64 %indvar31, 4
87 %tmp35 = add i64 %tmp34, 7
88 %arrayidx130 = getelementptr [32 x i16]* @in2, i64 0, i64 %tmp35
89 %tmp36 = add i64 %tmp34, 3
90 %arrayidx121 = getelementptr [32 x i16]* @in2, i64 0, i64 %tmp36
91 %tmp37 = add i64 %tmp34, 6
92 %arrayidx115 = getelementptr [32 x i16]* @in2, i64 0, i64 %tmp37
93 %tmp38 = add i64 %tmp34, 2
94 %arrayidx106 = getelementptr [32 x i16]* @in2, i64 0, i64 %tmp38
95 %tmp39 = add i64 %tmp34, 5
96 %arrayidx100 = getelementptr [32 x i16]* @in2, i64 0, i64 %tmp39
97 %tmp40 = add i64 %tmp34, 1
98 %arrayidx91 = getelementptr [32 x i16]* @in2, i64 0, i64 %tmp40
99 %tmp42 = add i64 %tmp34, 4
100 %arrayidx85 = getelementptr [32 x i16]* @in2, i64 0, i64 %tmp42
101 %arrayidx77 = getelementptr [32 x i16]* @in2, i64 0, i64 %tmp34
102 %exitcond33 = icmp ne i64 %indvar31, 7
103 br i1 %exitcond33, label %for.body73, label %for.end134
105 for.body73: ; preds = %for.cond69
106 %tmp78 = load i16* %arrayidx77, align 8
107 %add80 = add i16 %tmp78, 5
108 store i16 %add80, i16* %arrayidx85, align 8
109 %tmp92 = load i16* %arrayidx91, align 2
110 %add94 = add i16 %tmp92, 5
111 store i16 %add94, i16* %arrayidx100, align 2
112 %tmp107 = load i16* %arrayidx106, align 4
113 %add109 = add i16 %tmp107, 5
114 store i16 %add109, i16* %arrayidx115, align 4
115 %tmp122 = load i16* %arrayidx121, align 2
116 %add124 = add i16 %tmp122, 5
117 store i16 %add124, i16* %arrayidx130, align 2
120 for.inc131: ; preds = %for.body73
121 %indvar.next32 = add i64 %indvar31, 1
124 for.end134: ; preds = %for.cond69
125 br label %for.cond135
127 for.cond135: ; preds = %for.inc154, %for.end134
128 %indvar27 = phi i64 [ %indvar.next28, %for.inc154 ], [ 0, %for.end134 ]
129 %tmp29 = add i64 %indvar27, 4
130 %arrayidx147 = getelementptr [32 x i16]* @check, i64 0, i64 %tmp29
131 %arrayidx142 = getelementptr [32 x i16]* @in2, i64 0, i64 %tmp29
132 %i.3 = trunc i64 %tmp29 to i32
133 %cmp137 = icmp slt i32 %i.3, 32
134 br i1 %cmp137, label %for.body139, label %for.end157
136 for.body139: ; preds = %for.cond135
137 %tmp143 = load i16* %arrayidx142, align 2
138 %tmp148 = load i16* %arrayidx147, align 2
139 %cmp150 = icmp eq i16 %tmp143, %tmp148
140 br i1 %cmp150, label %if.end153, label %if.then152
142 if.then152: ; preds = %for.body139
143 call void @abort() noreturn nounwind
146 if.end153: ; preds = %for.body139
149 for.inc154: ; preds = %if.end153
150 %indvar.next28 = add i64 %indvar27, 1
151 br label %for.cond135
153 for.end157: ; preds = %for.cond135
154 br label %for.cond158
156 for.cond158: ; preds = %for.inc221, %for.end157
157 %indvar15 = phi i64 [ %indvar.next16, %for.inc221 ], [ 0, %for.end157 ]
158 %tmp17 = mul i64 %indvar15, 4
159 %tmp18 = add i64 %tmp17, 15
160 %arrayidx220 = getelementptr [32 x i16]* @in3, i64 0, i64 %tmp18
161 %tmp19 = add i64 %tmp17, 3
162 %arrayidx211 = getelementptr [32 x i16]* @in3, i64 0, i64 %tmp19
163 %tmp20 = add i64 %tmp17, 14
164 %arrayidx205 = getelementptr [32 x i16]* @in3, i64 0, i64 %tmp20
165 %tmp21 = add i64 %tmp17, 2
166 %arrayidx196 = getelementptr [32 x i16]* @in3, i64 0, i64 %tmp21
167 %tmp22 = add i64 %tmp17, 13
168 %arrayidx190 = getelementptr [32 x i16]* @in3, i64 0, i64 %tmp22
169 %tmp23 = add i64 %tmp17, 1
170 %arrayidx181 = getelementptr [32 x i16]* @in3, i64 0, i64 %tmp23
171 %tmp24 = add i64 %tmp17, 12
172 %arrayidx175 = getelementptr [32 x i16]* @in3, i64 0, i64 %tmp24
173 %arrayidx167 = getelementptr [32 x i16]* @in3, i64 0, i64 %tmp17
174 %exitcond = icmp ne i64 %indvar15, 5
175 br i1 %exitcond, label %for.body162, label %for.end224
177 for.body162: ; preds = %for.cond158
178 %tmp168 = load i16* %arrayidx167, align 8
179 %add170 = add i16 %tmp168, 5
180 store i16 %add170, i16* %arrayidx175, align 8
181 %tmp182 = load i16* %arrayidx181, align 2
182 %add184 = add i16 %tmp182, 5
183 store i16 %add184, i16* %arrayidx190, align 2
184 %tmp197 = load i16* %arrayidx196, align 4
185 %add199 = add i16 %tmp197, 5
186 store i16 %add199, i16* %arrayidx205, align 4
187 %tmp212 = load i16* %arrayidx211, align 2
188 %add214 = add i16 %tmp212, 5
189 store i16 %add214, i16* %arrayidx220, align 2
192 for.inc221: ; preds = %for.body162
193 %indvar.next16 = add i64 %indvar15, 1
194 br label %for.cond158
196 for.end224: ; preds = %for.cond158
197 br label %for.cond225
199 for.cond225: ; preds = %for.inc244, %for.end224
200 %indvar = phi i64 [ %indvar.next, %for.inc244 ], [ 0, %for.end224 ]
201 %tmp = add i64 %indvar, 12
202 %arrayidx237 = getelementptr [32 x i16]* @check3, i64 0, i64 %tmp
203 %arrayidx232 = getelementptr [32 x i16]* @in3, i64 0, i64 %tmp
204 %i.5 = trunc i64 %tmp to i32
205 %cmp227 = icmp slt i32 %i.5, 32
206 br i1 %cmp227, label %for.body229, label %for.end247
208 for.body229: ; preds = %for.cond225
209 %tmp233 = load i16* %arrayidx232, align 2
210 %tmp238 = load i16* %arrayidx237, align 2
211 %cmp240 = icmp eq i16 %tmp233, %tmp238
212 br i1 %cmp240, label %if.end243, label %if.then242
214 if.then242: ; preds = %for.body229
215 call void @abort() noreturn nounwind
218 if.end243: ; preds = %for.body229
221 for.inc244: ; preds = %if.end243
222 %indvar.next = add i64 %indvar, 1
223 br label %for.cond225
225 for.end247: ; preds = %for.cond225
229 declare void @abort() noreturn
231 define i32 @main() nounwind uwtable {
233 call void @check_vect()
234 %call = call i32 @main1()
238 define internal void @check_vect() nounwind uwtable noinline {
240 %a = alloca i32, align 4
241 %b = alloca i32, align 4
242 %c = alloca i32, align 4
243 %d = alloca i32, align 4
244 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
245 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
246 %tobool = icmp eq i32 %call1, 0
247 br i1 %tobool, label %if.then, label %lor.lhs.false
249 lor.lhs.false: ; preds = %entry
250 %tmp4 = load i32* %d, align 4
251 %and6 = and i32 %tmp4, 67108864
252 %cmp = icmp eq i32 %and6, 0
253 br i1 %cmp, label %if.then, label %if.end
255 if.then: ; preds = %entry, %lor.lhs.false
256 call void @exit(i32 0) noreturn nounwind
259 if.end: ; preds = %lor.lhs.false
260 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
264 declare void (i32)* @signal(i32, void (i32)*) nounwind
266 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
268 call void @exit(i32 0) noreturn nounwind
271 return: ; No predecessors!
275 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
277 %and = and i32 %__level, -2147483648
278 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
279 %cmp = icmp ult i32 %call, %__level
280 br i1 %cmp, label %if.then, label %if.end
282 if.then: ; preds = %entry
285 if.end: ; preds = %entry
286 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
287 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
288 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
289 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
290 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
291 store i32 %asmresult, i32* %__eax, align 4
292 store i32 %asmresult8, i32* %__ebx, align 4
293 store i32 %asmresult9, i32* %__ecx, align 4
294 store i32 %asmresult10, i32* %__edx, align 4
297 return: ; preds = %if.end, %if.then
298 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
302 declare void @exit(i32) noreturn
304 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
306 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
307 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
308 %tobool = icmp eq i32* %__sig, null
309 br i1 %tobool, label %if.end, label %if.then
311 if.then: ; preds = %entry
312 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
313 store i32 %asmresult1, i32* %__sig, align 4
316 if.end: ; preds = %entry, %if.then
320 !0 = metadata !{i32 -2147342189, i32 -2147342181}
321 !1 = metadata !{i32 -2147342312, i32 -2147342304}