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-12a.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer slp-12a.s > slp-12a.ll
6 ; ModuleID = 'slp-12a.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 @main1.in = internal unnamed_addr constant [64 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18, i32 19, i32 20, i32 21, i32 22, i32 23, i32 24, i32 25, i32 26, i32 27, i32 28, i32 29, i32 30, i32 31, i32 32, i32 33, i32 34, i32 35, i32 36, i32 37, i32 38, i32 39, i32 40, i32 41, i32 42, i32 43, i32 44, i32 45, i32 46, i32 47, i32 48, i32 49, i32 50, i32 51, i32 52, i32 53, i32 54, i32 55, i32 56, i32 57, i32 58, i32 59, i32 60, i32 61, i32 62, i32 63], align 16
12 define i32 @main1() nounwind uwtable {
14 %out = alloca [64 x i32], align 16
15 %in = alloca [64 x i32], align 16
16 %ia = alloca [8 x i32], align 16
17 %tmp = bitcast [64 x i32]* %in to i8*
18 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp, i8* bitcast ([64 x i32]* @main1.in to i8*), i64 256, i32 16, i1 false)
21 for.cond: ; preds = %for.inc, %entry
22 %indvar50 = phi i64 [ %indvar.next51, %for.inc ], [ 0, %entry ]
23 %tmp53 = mul i64 %indvar50, 8
24 %tmp54 = add i64 %tmp53, 7
25 %arrayidx123 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp54
26 %tmp55 = add i64 %tmp53, 6
27 %arrayidx116 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp55
28 %tmp56 = add i64 %tmp53, 5
29 %arrayidx109 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp56
30 %tmp57 = add i64 %tmp53, 4
31 %arrayidx102 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp57
32 %tmp58 = add i64 %tmp53, 3
33 %arrayidx95 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp58
34 %tmp59 = add i64 %tmp53, 2
35 %arrayidx88 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp59
36 %tmp60 = add i64 %tmp53, 1
37 %arrayidx81 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp60
38 %arrayidx74 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp53
39 %arrayidx51 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp54
40 %arrayidx44 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp55
41 %arrayidx37 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp56
42 %arrayidx30 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp57
43 %arrayidx23 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp58
44 %arrayidx16 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp59
45 %arrayidx9 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp60
46 %arrayidx = getelementptr [64 x i32]* %in, i64 0, i64 %tmp53
47 %arrayidx127 = getelementptr [8 x i32]* %ia, i64 0, i64 %indvar50
48 %exitcond = icmp ne i64 %indvar50, 8
49 br i1 %exitcond, label %for.body, label %for.end
51 for.body: ; preds = %for.cond
52 %tmp4 = load i32* %arrayidx, align 16
53 %tmp10 = load i32* %arrayidx9, align 4
54 %tmp17 = load i32* %arrayidx16, align 8
55 %tmp24 = load i32* %arrayidx23, align 4
56 %tmp31 = load i32* %arrayidx30, align 16
57 %tmp38 = load i32* %arrayidx37, align 4
58 %tmp45 = load i32* %arrayidx44, align 8
59 %tmp52 = load i32* %arrayidx51, align 4
60 %tmp28 = mul i32 %tmp4, 3
61 %add11 = shl i32 %tmp10, 1
62 %tmp29 = mul i32 %tmp17, 12
63 %tmp30 = mul i32 %tmp24, 5
64 %add32 = shl i32 %tmp31, 3
65 %add39 = shl i32 %tmp38, 2
66 %tmp32 = mul i32 %tmp45, 3
67 %mul67 = add i32 %tmp32, 33
68 %add53 = shl i32 %tmp52, 1
69 %sub = add i32 %tmp28, 13
70 store i32 %sub, i32* %arrayidx74, align 16
71 %sub76 = add i32 %add11, 9
72 store i32 %sub76, i32* %arrayidx81, align 4
73 %sub83 = add i32 %tmp29, 82
74 store i32 %sub83, i32* %arrayidx88, align 8
75 %sub90 = add i32 %tmp30, 39
76 store i32 %sub90, i32* %arrayidx95, align 4
77 %sub97 = add i32 %add32, 64
78 store i32 %sub97, i32* %arrayidx102, align 16
79 %sub104 = add i32 %add39, 33
80 store i32 %sub104, i32* %arrayidx109, align 4
81 %sub111 = add i32 %tmp32, 30
82 store i32 %sub111, i32* %arrayidx116, align 8
83 %sub118 = add i32 %add53, 17
84 store i32 %sub118, i32* %arrayidx123, align 4
85 store i32 %mul67, i32* %arrayidx127, align 4
88 for.inc: ; preds = %for.body
89 %indvar.next51 = add i64 %indvar50, 1
92 for.end: ; preds = %for.cond
95 for.cond129: ; preds = %for.inc279, %for.end
96 %indvar = phi i64 [ %indvar.next, %for.inc279 ], [ 0, %for.end ]
97 %tmp40 = mul i64 %indvar, 8
98 %tmp41 = add i64 %tmp40, 6
99 %arrayidx242 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp41
100 %tmp42 = add i64 %tmp40, 7
101 %arrayidx259 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp42
102 %arrayidx253 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp42
103 %arrayidx236 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp41
104 %tmp43 = add i64 %tmp40, 5
105 %arrayidx225 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp43
106 %arrayidx219 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp43
107 %tmp44 = add i64 %tmp40, 4
108 %arrayidx208 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp44
109 %arrayidx202 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp44
110 %tmp46 = add i64 %tmp40, 3
111 %arrayidx191 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp46
112 %arrayidx185 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp46
113 %tmp47 = add i64 %tmp40, 2
114 %arrayidx174 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp47
115 %arrayidx168 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp47
116 %tmp48 = add i64 %tmp40, 1
117 %arrayidx157 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp48
118 %arrayidx151 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp48
119 %arrayidx141 = getelementptr [64 x i32]* %in, i64 0, i64 %tmp40
120 %arrayidx136 = getelementptr [64 x i32]* %out, i64 0, i64 %tmp40
121 %arrayidx268 = getelementptr [8 x i32]* %ia, i64 0, i64 %indvar
122 %i.1 = trunc i64 %indvar to i32
123 %cmp131 = icmp slt i32 %i.1, 8
124 br i1 %cmp131, label %for.body132, label %for.end282
126 for.body132: ; preds = %for.cond129
127 %tmp137 = load i32* %arrayidx136, align 16
128 %tmp142 = load i32* %arrayidx141, align 16
129 %tmp1 = mul i32 %tmp142, 3
130 %sub145 = add i32 %tmp1, 13
131 %cmp146 = icmp eq i32 %tmp137, %sub145
132 br i1 %cmp146, label %lor.lhs.false, label %if.then
134 lor.lhs.false: ; preds = %for.body132
135 %tmp152 = load i32* %arrayidx151, align 4
136 %tmp158 = load i32* %arrayidx157, align 4
137 %add159 = shl i32 %tmp158, 1
138 %sub161 = add i32 %add159, 9
139 %cmp162 = icmp eq i32 %tmp152, %sub161
140 br i1 %cmp162, label %lor.lhs.false163, label %if.then
142 lor.lhs.false163: ; preds = %lor.lhs.false
143 %tmp169 = load i32* %arrayidx168, align 8
144 %tmp175 = load i32* %arrayidx174, align 8
145 %tmp6 = mul i32 %tmp175, 12
146 %sub178 = add i32 %tmp6, 82
147 %cmp179 = icmp eq i32 %tmp169, %sub178
148 br i1 %cmp179, label %lor.lhs.false180, label %if.then
150 lor.lhs.false180: ; preds = %lor.lhs.false163
151 %tmp186 = load i32* %arrayidx185, align 4
152 %tmp192 = load i32* %arrayidx191, align 4
153 %tmp9 = mul i32 %tmp192, 5
154 %sub195 = add i32 %tmp9, 39
155 %cmp196 = icmp eq i32 %tmp186, %sub195
156 br i1 %cmp196, label %lor.lhs.false197, label %if.then
158 lor.lhs.false197: ; preds = %lor.lhs.false180
159 %tmp203 = load i32* %arrayidx202, align 16
160 %tmp209 = load i32* %arrayidx208, align 16
161 %add210 = shl i32 %tmp209, 3
162 %sub212 = add i32 %add210, 64
163 %cmp213 = icmp eq i32 %tmp203, %sub212
164 br i1 %cmp213, label %lor.lhs.false214, label %if.then
166 lor.lhs.false214: ; preds = %lor.lhs.false197
167 %tmp220 = load i32* %arrayidx219, align 4
168 %tmp226 = load i32* %arrayidx225, align 4
169 %add227 = shl i32 %tmp226, 2
170 %sub229 = add i32 %add227, 33
171 %cmp230 = icmp eq i32 %tmp220, %sub229
172 br i1 %cmp230, label %lor.lhs.false231, label %if.then
174 lor.lhs.false231: ; preds = %lor.lhs.false214
175 %tmp237 = load i32* %arrayidx236, align 8
176 %tmp243 = load i32* %arrayidx242, align 8
177 %tmp16 = mul i32 %tmp243, 3
178 %sub246 = add i32 %tmp16, 30
179 %cmp247 = icmp eq i32 %tmp237, %sub246
180 br i1 %cmp247, label %lor.lhs.false248, label %if.then
182 lor.lhs.false248: ; preds = %lor.lhs.false231
183 %tmp254 = load i32* %arrayidx253, align 4
184 %tmp260 = load i32* %arrayidx259, align 4
185 %add261 = shl i32 %tmp260, 1
186 %sub263 = add i32 %add261, 17
187 %cmp264 = icmp eq i32 %tmp254, %sub263
188 br i1 %cmp264, label %lor.lhs.false265, label %if.then
190 lor.lhs.false265: ; preds = %lor.lhs.false248
191 %tmp269 = load i32* %arrayidx268, align 4
192 %tmp275 = load i32* %arrayidx242, align 8
193 %tmp20 = mul i32 %tmp275, 3
194 %mul277 = add i32 %tmp20, 33
195 %cmp278 = icmp eq i32 %tmp269, %mul277
196 br i1 %cmp278, label %if.end, label %if.then
198 if.then: ; preds = %lor.lhs.false265, %lor.lhs.false248, %lor.lhs.false231, %lor.lhs.false214, %lor.lhs.false197, %lor.lhs.false180, %lor.lhs.false163, %lor.lhs.false, %for.body132
199 call void @abort() noreturn nounwind
202 if.end: ; preds = %lor.lhs.false265
205 for.inc279: ; preds = %if.end
206 %indvar.next = add i64 %indvar, 1
207 br label %for.cond129
209 for.end282: ; preds = %for.cond129
213 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
215 declare void @abort() noreturn
217 define i32 @main() nounwind uwtable {
219 call void @check_vect()
220 %call = call i32 @main1()
224 define internal void @check_vect() nounwind uwtable noinline {
226 %a = alloca i32, align 4
227 %b = alloca i32, align 4
228 %c = alloca i32, align 4
229 %d = alloca i32, align 4
230 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
231 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
232 %tobool = icmp eq i32 %call1, 0
233 br i1 %tobool, label %if.then, label %lor.lhs.false
235 lor.lhs.false: ; preds = %entry
236 %tmp4 = load i32* %d, align 4
237 %and6 = and i32 %tmp4, 67108864
238 %cmp = icmp eq i32 %and6, 0
239 br i1 %cmp, label %if.then, label %if.end
241 if.then: ; preds = %entry, %lor.lhs.false
242 call void @exit(i32 0) noreturn nounwind
245 if.end: ; preds = %lor.lhs.false
246 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
250 declare void (i32)* @signal(i32, void (i32)*) nounwind
252 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
254 call void @exit(i32 0) noreturn nounwind
257 return: ; No predecessors!
261 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
263 %and = and i32 %__level, -2147483648
264 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
265 %cmp = icmp ult i32 %call, %__level
266 br i1 %cmp, label %if.then, label %if.end
268 if.then: ; preds = %entry
271 if.end: ; preds = %entry
272 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
273 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
274 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
275 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
276 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
277 store i32 %asmresult, i32* %__eax, align 4
278 store i32 %asmresult8, i32* %__ebx, align 4
279 store i32 %asmresult9, i32* %__ecx, align 4
280 store i32 %asmresult10, i32* %__edx, align 4
283 return: ; preds = %if.end, %if.then
284 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
288 declare void @exit(i32) noreturn
290 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
292 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
293 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
294 %tobool = icmp eq i32* %__sig, null
295 br i1 %tobool, label %if.end, label %if.then
297 if.then: ; preds = %entry
298 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
299 store i32 %asmresult1, i32* %__sig, align 4
302 if.end: ; preds = %entry, %if.then
306 !0 = metadata !{i32 -2147342015, i32 -2147342007}
307 !1 = metadata !{i32 -2147342138, i32 -2147342130}