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-17.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer slp-17.s > slp-17.ll
6 ; ModuleID = 'slp-17.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 [64 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, i16 32, i16 33, i16 34, i16 35, i16 36, i16 37, i16 38, i16 39, i16 40, i16 41, i16 42, i16 43, i16 44, i16 45, i16 46, i16 47, i16 48, i16 49, i16 50, i16 51, i16 52, i16 53, i16 54, i16 55, i16 56, i16 57, i16 58, i16 59, i16 60, i16 61, i16 62, i16 63], align 16
11 @in2 = global [64 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, i16 32, i16 33, i16 34, i16 35, i16 36, i16 37, i16 38, i16 39, i16 40, i16 41, i16 42, i16 43, i16 44, i16 45, i16 46, i16 47, i16 48, i16 49, i16 50, i16 51, i16 52, i16 53, i16 54, i16 55, i16 56, i16 57, i16 58, i16 59, i16 60, i16 61, i16 62, i16 63], align 16
12 @out = common global [64 x i16] zeroinitializer, align 16
13 @out2 = common global [64 x i16] zeroinitializer, align 16
15 define i32 @main1() nounwind uwtable {
19 for.cond: ; preds = %for.inc, %entry
20 %indvar23 = phi i64 [ %indvar.next24, %for.inc ], [ 0, %entry ]
21 %tmp25 = mul i64 %indvar23, 4
22 %tmp27 = add i64 %tmp25, 3
23 %arrayidx75 = getelementptr [64 x i16]* @out2, i64 0, i64 %tmp27
24 %arrayidx66 = getelementptr [64 x i16]* @in2, i64 0, i64 %tmp27
25 %tmp28 = add i64 %tmp25, 2
26 %arrayidx61 = getelementptr [64 x i16]* @out2, i64 0, i64 %tmp28
27 %arrayidx52 = getelementptr [64 x i16]* @in2, i64 0, i64 %tmp28
28 %tmp29 = add i64 %tmp25, 1
29 %arrayidx47 = getelementptr [64 x i16]* @out2, i64 0, i64 %tmp29
30 %arrayidx38 = getelementptr [64 x i16]* @in2, i64 0, i64 %tmp29
31 %arrayidx33 = getelementptr [64 x i16]* @out2, i64 0, i64 %tmp25
32 %arrayidx25 = getelementptr [64 x i16]* @in2, i64 0, i64 %tmp25
33 %tmp30 = mul i64 %indvar23, 2
34 %tmp31 = add i64 %tmp30, 1
35 %arrayidx21 = getelementptr [64 x i16]* @out, i64 0, i64 %tmp31
36 %arrayidx12 = getelementptr [64 x i16]* @in, i64 0, i64 %tmp31
37 %arrayidx7 = getelementptr [64 x i16]* @out, i64 0, i64 %tmp30
38 %arrayidx = getelementptr [64 x i16]* @in, i64 0, i64 %tmp30
39 %exitcond = icmp ne i64 %indvar23, 16
40 br i1 %exitcond, label %for.body, label %for.end
42 for.body: ; preds = %for.cond
43 %tmp2 = load i16* %arrayidx, align 4
44 %add = add i16 %tmp2, 5
45 store i16 %add, i16* %arrayidx7, align 4
46 %tmp13 = load i16* %arrayidx12, align 2
47 %add15 = add i16 %tmp13, 6
48 store i16 %add15, i16* %arrayidx21, align 2
49 %tmp26 = load i16* %arrayidx25, align 8
50 %add28 = add i16 %tmp26, 2
51 store i16 %add28, i16* %arrayidx33, align 8
52 %tmp39 = load i16* %arrayidx38, align 2
53 %add41 = add i16 %tmp39, 2
54 store i16 %add41, i16* %arrayidx47, align 2
55 %tmp53 = load i16* %arrayidx52, align 4
56 %add55 = add i16 %tmp53, 1
57 store i16 %add55, i16* %arrayidx61, align 4
58 %tmp67 = load i16* %arrayidx66, align 2
59 %add69 = add i16 %tmp67, 3
60 store i16 %add69, i16* %arrayidx75, align 2
63 for.inc: ; preds = %for.body
64 %indvar.next24 = add i64 %indvar23, 1
67 for.end: ; preds = %for.cond
70 for.cond77: ; preds = %for.inc184, %for.end
71 %indvar = phi i64 [ %indvar.next, %for.inc184 ], [ 0, %for.end ]
72 %tmp = mul i64 %indvar, 4
73 %tmp17 = add i64 %tmp, 3
74 %arrayidx178 = getelementptr [64 x i16]* @in2, i64 0, i64 %tmp17
75 %arrayidx171 = getelementptr [64 x i16]* @out2, i64 0, i64 %tmp17
76 %tmp18 = add i64 %tmp, 2
77 %arrayidx160 = getelementptr [64 x i16]* @in2, i64 0, i64 %tmp18
78 %arrayidx153 = getelementptr [64 x i16]* @out2, i64 0, i64 %tmp18
79 %tmp19 = add i64 %tmp, 1
80 %arrayidx142 = getelementptr [64 x i16]* @in2, i64 0, i64 %tmp19
81 %arrayidx135 = getelementptr [64 x i16]* @out2, i64 0, i64 %tmp19
82 %arrayidx124 = getelementptr [64 x i16]* @in2, i64 0, i64 %tmp
83 %arrayidx118 = getelementptr [64 x i16]* @out2, i64 0, i64 %tmp
84 %tmp20 = mul i64 %indvar, 2
85 %tmp21 = add i64 %tmp20, 1
86 %arrayidx108 = getelementptr [64 x i16]* @in, i64 0, i64 %tmp21
87 %arrayidx101 = getelementptr [64 x i16]* @out, i64 0, i64 %tmp21
88 %arrayidx91 = getelementptr [64 x i16]* @in, i64 0, i64 %tmp20
89 %arrayidx85 = getelementptr [64 x i16]* @out, i64 0, i64 %tmp20
90 %i.1 = trunc i64 %indvar to i32
91 %cmp79 = icmp slt i32 %i.1, 16
92 br i1 %cmp79, label %for.body81, label %for.end187
94 for.body81: ; preds = %for.cond77
95 %tmp86 = load i16* %arrayidx85, align 4
96 %conv87 = zext i16 %tmp86 to i32
97 %tmp92 = load i16* %arrayidx91, align 4
98 %conv93 = zext i16 %tmp92 to i32
99 %add94 = add nsw i32 %conv93, 5
100 %cmp95 = icmp eq i32 %conv87, %add94
101 br i1 %cmp95, label %lor.lhs.false, label %if.then
103 lor.lhs.false: ; preds = %for.body81
104 %tmp102 = load i16* %arrayidx101, align 2
105 %conv103 = zext i16 %tmp102 to i32
106 %tmp109 = load i16* %arrayidx108, align 2
107 %conv110 = zext i16 %tmp109 to i32
108 %add111 = add nsw i32 %conv110, 6
109 %cmp112 = icmp eq i32 %conv103, %add111
110 br i1 %cmp112, label %lor.lhs.false114, label %if.then
112 lor.lhs.false114: ; preds = %lor.lhs.false
113 %tmp119 = load i16* %arrayidx118, align 8
114 %conv120 = zext i16 %tmp119 to i32
115 %tmp125 = load i16* %arrayidx124, align 8
116 %conv126 = zext i16 %tmp125 to i32
117 %add127 = add nsw i32 %conv126, 2
118 %cmp128 = icmp eq i32 %conv120, %add127
119 br i1 %cmp128, label %lor.lhs.false130, label %if.then
121 lor.lhs.false130: ; preds = %lor.lhs.false114
122 %tmp136 = load i16* %arrayidx135, align 2
123 %conv137 = zext i16 %tmp136 to i32
124 %tmp143 = load i16* %arrayidx142, align 2
125 %conv144 = zext i16 %tmp143 to i32
126 %add145 = add nsw i32 %conv144, 2
127 %cmp146 = icmp eq i32 %conv137, %add145
128 br i1 %cmp146, label %lor.lhs.false148, label %if.then
130 lor.lhs.false148: ; preds = %lor.lhs.false130
131 %tmp154 = load i16* %arrayidx153, align 4
132 %conv155 = zext i16 %tmp154 to i32
133 %tmp161 = load i16* %arrayidx160, align 4
134 %conv162 = zext i16 %tmp161 to i32
135 %add163 = add nsw i32 %conv162, 1
136 %cmp164 = icmp eq i32 %conv155, %add163
137 br i1 %cmp164, label %lor.lhs.false166, label %if.then
139 lor.lhs.false166: ; preds = %lor.lhs.false148
140 %tmp172 = load i16* %arrayidx171, align 2
141 %conv173 = zext i16 %tmp172 to i32
142 %tmp179 = load i16* %arrayidx178, align 2
143 %conv180 = zext i16 %tmp179 to i32
144 %add181 = add nsw i32 %conv180, 3
145 %cmp182 = icmp eq i32 %conv173, %add181
146 br i1 %cmp182, label %if.end, label %if.then
148 if.then: ; preds = %lor.lhs.false166, %lor.lhs.false148, %lor.lhs.false130, %lor.lhs.false114, %lor.lhs.false, %for.body81
149 call void @abort() noreturn nounwind
152 if.end: ; preds = %lor.lhs.false166
155 for.inc184: ; preds = %if.end
156 %indvar.next = add i64 %indvar, 1
159 for.end187: ; preds = %for.cond77
163 declare void @abort() noreturn
165 define i32 @main() nounwind uwtable {
167 call void @check_vect()
168 %call = call i32 @main1()
172 define internal void @check_vect() nounwind uwtable noinline {
174 %a = alloca i32, align 4
175 %b = alloca i32, align 4
176 %c = alloca i32, align 4
177 %d = alloca i32, align 4
178 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
179 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
180 %tobool = icmp eq i32 %call1, 0
181 br i1 %tobool, label %if.then, label %lor.lhs.false
183 lor.lhs.false: ; preds = %entry
184 %tmp4 = load i32* %d, align 4
185 %and6 = and i32 %tmp4, 67108864
186 %cmp = icmp eq i32 %and6, 0
187 br i1 %cmp, label %if.then, label %if.end
189 if.then: ; preds = %entry, %lor.lhs.false
190 call void @exit(i32 0) noreturn nounwind
193 if.end: ; preds = %lor.lhs.false
194 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
198 declare void (i32)* @signal(i32, void (i32)*) nounwind
200 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
202 call void @exit(i32 0) noreturn nounwind
205 return: ; No predecessors!
209 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
211 %and = and i32 %__level, -2147483648
212 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
213 %cmp = icmp ult i32 %call, %__level
214 br i1 %cmp, label %if.then, label %if.end
216 if.then: ; preds = %entry
219 if.end: ; preds = %entry
220 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
221 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
222 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
223 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
224 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
225 store i32 %asmresult, i32* %__eax, align 4
226 store i32 %asmresult8, i32* %__ebx, align 4
227 store i32 %asmresult9, i32* %__ecx, align 4
228 store i32 %asmresult10, i32* %__edx, align 4
231 return: ; preds = %if.end, %if.then
232 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
236 declare void @exit(i32) noreturn
238 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
240 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
241 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
242 %tobool = icmp eq i32* %__sig, null
243 br i1 %tobool, label %if.end, label %if.then
245 if.then: ; preds = %entry
246 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
247 store i32 %asmresult1, i32* %__sig, align 4
250 if.end: ; preds = %entry, %if.then
254 !0 = metadata !{i32 -2147342829, i32 -2147342821}
255 !1 = metadata !{i32 -2147342952, i32 -2147342944}