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-93.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-93.s > vect-93.ll
6 ; ModuleID = 'vect-93.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 i32 @main1(float* %pa) nounwind uwtable noinline {
14 for.cond: ; preds = %for.inc, %entry
15 %indvar9 = phi i64 [ %indvar.next10, %for.inc ], [ 0, %entry ]
16 %arrayidx = getelementptr float* %pa, i64 %indvar9
17 %exitcond11 = icmp ne i64 %indvar9, 3001
18 br i1 %exitcond11, label %for.body, label %for.end
20 for.body: ; preds = %for.cond
21 store float 2.000000e+00, float* %arrayidx, align 4
24 for.inc: ; preds = %for.body
25 %indvar.next10 = add i64 %indvar9, 1
28 for.end: ; preds = %for.cond
31 for.cond4: ; preds = %for.inc15, %for.end
32 %indvar6 = phi i64 [ %indvar.next7, %for.inc15 ], [ 0, %for.end ]
33 %arrayidx11 = getelementptr float* %pa, i64 %indvar6
34 %i.1 = trunc i64 %indvar6 to i32
35 %cmp6 = icmp slt i32 %i.1, 3001
36 br i1 %cmp6, label %for.body7, label %for.end18
38 for.body7: ; preds = %for.cond4
39 %tmp12 = load float* %arrayidx11, align 4
40 %cmp13 = fcmp une float %tmp12, 2.000000e+00
41 br i1 %cmp13, label %if.then, label %if.end
43 if.then: ; preds = %for.body7
44 call void @abort() noreturn nounwind
47 if.end: ; preds = %for.body7
50 for.inc15: ; preds = %if.end
51 %indvar.next7 = add i64 %indvar6, 1
54 for.end18: ; preds = %for.cond4
57 for.cond19: ; preds = %for.inc28, %for.end18
58 %indvar2 = phi i64 [ %indvar.next3, %for.inc28 ], [ 0, %for.end18 ]
59 %tmp4 = add i64 %indvar2, 1
60 %arrayidx27 = getelementptr float* %pa, i64 %tmp4
61 %exitcond = icmp ne i64 %indvar2, 10
62 br i1 %exitcond, label %for.body23, label %for.end31
64 for.body23: ; preds = %for.cond19
65 store float 3.000000e+00, float* %arrayidx27, align 4
68 for.inc28: ; preds = %for.body23
69 %indvar.next3 = add i64 %indvar2, 1
72 for.end31: ; preds = %for.cond19
75 for.cond32: ; preds = %for.inc47, %for.end31
76 %indvar = phi i64 [ %indvar.next, %for.inc47 ], [ 0, %for.end31 ]
77 %tmp = add i64 %indvar, 1
78 %i.3 = trunc i64 %tmp to i32
79 %arrayidx40 = getelementptr float* %pa, i64 %tmp
80 %cmp34 = icmp slt i32 %i.3, 11
81 br i1 %cmp34, label %for.body36, label %for.end50
83 for.body36: ; preds = %for.cond32
84 %tmp41 = load float* %arrayidx40, align 4
85 %cmp43 = fcmp une float %tmp41, 3.000000e+00
86 br i1 %cmp43, label %if.then45, label %if.end46
88 if.then45: ; preds = %for.body36
89 call void @abort() noreturn nounwind
92 if.end46: ; preds = %for.body36
95 for.inc47: ; preds = %if.end46
96 %indvar.next = add i64 %indvar, 1
99 for.end50: ; preds = %for.cond32
103 declare void @abort() noreturn
105 define i32 @main() nounwind uwtable {
107 %a = alloca [3001 x float], align 16
108 %b = alloca [3001 x float], align 16
109 call void @check_vect()
112 for.cond: ; preds = %for.inc, %entry
113 %indvar6 = phi i64 [ %indvar.next7, %for.inc ], [ 0, %entry ]
114 %arrayidx = getelementptr [3001 x float]* %b, i64 0, i64 %indvar6
115 %i.0 = trunc i64 %indvar6 to i32
116 %exitcond8 = icmp ne i64 %indvar6, 3001
117 br i1 %exitcond8, label %for.body, label %for.end
119 for.body: ; preds = %for.cond
120 %conv = sitofp i32 %i.0 to float
121 store float %conv, float* %arrayidx, align 4
124 for.inc: ; preds = %for.body
125 %indvar.next7 = add i64 %indvar6, 1
128 for.end: ; preds = %for.cond
129 %arrayidx4 = getelementptr inbounds [3001 x float]* %a, i64 0, i64 0
130 store float 0.000000e+00, float* %arrayidx4, align 16
133 for.cond5: ; preds = %for.inc17, %for.end
134 %indvar2 = phi i64 [ %indvar.next3, %for.inc17 ], [ 0, %for.end ]
135 %arrayidx12 = getelementptr [3001 x float]* %b, i64 0, i64 %indvar2
136 %tmp4 = add i64 %indvar2, 1
137 %arrayidx16 = getelementptr [3001 x float]* %a, i64 0, i64 %tmp4
138 %exitcond = icmp ne i64 %indvar2, 256
139 br i1 %exitcond, label %for.body9, label %for.end20
141 for.body9: ; preds = %for.cond5
142 %tmp13 = load float* %arrayidx12, align 4
143 store float %tmp13, float* %arrayidx16, align 4
146 for.inc17: ; preds = %for.body9
147 %indvar.next3 = add i64 %indvar2, 1
150 for.end20: ; preds = %for.cond5
153 for.cond21: ; preds = %for.inc35, %for.end20
154 %indvar = phi i64 [ %indvar.next, %for.inc35 ], [ 0, %for.end20 ]
155 %sub31 = trunc i64 %indvar to i32
156 %tmp = add i64 %indvar, 1
157 %i.2 = trunc i64 %tmp to i32
158 %arrayidx28 = getelementptr [3001 x float]* %a, i64 0, i64 %tmp
159 %cmp23 = icmp slt i32 %i.2, 257
160 br i1 %cmp23, label %for.body25, label %for.end38
162 for.body25: ; preds = %for.cond21
163 %tmp29 = load float* %arrayidx28, align 4
164 %conv32 = sitofp i32 %sub31 to float
165 %cmp33 = fcmp une float %tmp29, %conv32
166 br i1 %cmp33, label %if.then, label %if.end
168 if.then: ; preds = %for.body25
169 call void @abort() noreturn nounwind
172 if.end: ; preds = %for.body25
175 for.inc35: ; preds = %if.end
176 %indvar.next = add i64 %indvar, 1
179 for.end38: ; preds = %for.cond21
180 %arrayidx39 = getelementptr inbounds [3001 x float]* %a, i64 0, i64 0
181 %tmp40 = load float* %arrayidx39, align 16
182 %cmp41 = fcmp une float %tmp40, 0.000000e+00
183 br i1 %cmp41, label %if.then43, label %if.end44
185 if.then43: ; preds = %for.end38
186 call void @abort() noreturn nounwind
189 if.end44: ; preds = %for.end38
190 %arraydecay = getelementptr inbounds [3001 x float]* %a, i64 0, i64 0
191 %call = call i32 @main1(float* %arraydecay)
195 define internal void @check_vect() nounwind uwtable noinline {
197 %a = alloca i32, align 4
198 %b = alloca i32, align 4
199 %c = alloca i32, align 4
200 %d = alloca i32, align 4
201 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
202 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
203 %tobool = icmp eq i32 %call1, 0
204 br i1 %tobool, label %if.then, label %lor.lhs.false
206 lor.lhs.false: ; preds = %entry
207 %tmp4 = load i32* %d, align 4
208 %and6 = and i32 %tmp4, 67108864
209 %cmp = icmp eq i32 %and6, 0
210 br i1 %cmp, label %if.then, label %if.end
212 if.then: ; preds = %entry, %lor.lhs.false
213 call void @exit(i32 0) noreturn nounwind
216 if.end: ; preds = %lor.lhs.false
217 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
221 declare void (i32)* @signal(i32, void (i32)*) nounwind
223 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
225 call void @exit(i32 0) noreturn nounwind
228 return: ; No predecessors!
232 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
234 %and = and i32 %__level, -2147483648
235 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
236 %cmp = icmp ult i32 %call, %__level
237 br i1 %cmp, label %if.then, label %if.end
239 if.then: ; preds = %entry
242 if.end: ; preds = %entry
243 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
244 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
245 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
246 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
247 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
248 store i32 %asmresult, i32* %__eax, align 4
249 store i32 %asmresult8, i32* %__ebx, align 4
250 store i32 %asmresult9, i32* %__ecx, align 4
251 store i32 %asmresult10, i32* %__edx, align 4
254 return: ; preds = %if.end, %if.then
255 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
259 declare void @exit(i32) noreturn
261 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
263 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
264 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
265 %tobool = icmp eq i32* %__sig, null
266 br i1 %tobool, label %if.end, label %if.then
268 if.then: ; preds = %entry
269 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
270 store i32 %asmresult1, i32* %__sig, align 4
273 if.end: ; preds = %entry, %if.then
277 !0 = metadata !{i32 -2147342154, i32 -2147342146}
278 !1 = metadata !{i32 -2147342277, i32 -2147342269}