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 no-vfa-vect-dv-2.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer no-vfa-vect-dv-2.s > no-vfa-vect-dv-2.ll
6 ; ModuleID = 'no-vfa-vect-dv-2.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 @main() nounwind uwtable {
12 %A = alloca [64 x i32], align 16
13 %B = alloca [64 x i32], align 16
14 %C = alloca [64 x i32], align 16
15 %D = alloca [64 x i32], align 16
16 %E = alloca [64 x i32], align 16
17 %tmp = bitcast [64 x i32]* %E to i8*
18 call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 256, i32 16, i1 false)
19 %tmp27 = getelementptr [64 x i32]* %E, i64 0, i64 1
20 store i32 1, i32* %tmp27, align 4
21 %tmp28 = getelementptr [64 x i32]* %E, i64 0, i64 2
22 store i32 2, i32* %tmp28, align 8
23 call void @check_vect()
26 for.cond: ; preds = %for.inc, %entry
27 %indvar22 = phi i64 [ %indvar.next23, %for.inc ], [ 0, %entry ]
28 %arrayidx17 = getelementptr [64 x i32]* %D, i64 0, i64 %indvar22
29 %i.0 = trunc i64 %indvar22 to i32
30 %arrayidx13 = getelementptr [64 x i32]* %C, i64 0, i64 %indvar22
31 %arrayidx9 = getelementptr [64 x i32]* %B, i64 0, i64 %indvar22
32 %arrayidx = getelementptr [64 x i32]* %A, i64 0, i64 %indvar22
33 %exitcond24 = icmp ne i64 %indvar22, 64
34 br i1 %exitcond24, label %for.body, label %for.end
36 for.body: ; preds = %for.cond
37 store i32 %i.0, i32* %arrayidx, align 4
38 store i32 %i.0, i32* %arrayidx9, align 4
39 store i32 %i.0, i32* %arrayidx13, align 4
40 store i32 %i.0, i32* %arrayidx17, align 4
43 for.inc: ; preds = %for.body
44 %indvar.next23 = add i64 %indvar22, 1
47 for.end: ; preds = %for.cond
50 for.cond19: ; preds = %for.inc30, %for.end
51 %indvar17 = phi i64 [ %indvar.next18, %for.inc30 ], [ 0, %for.end ]
52 %arrayidx29 = getelementptr [64 x i32]* %A, i64 0, i64 %indvar17
53 %tmp20 = add i64 %indvar17, 20
54 %arrayidx25 = getelementptr [64 x i32]* %A, i64 0, i64 %tmp20
55 %exitcond19 = icmp ne i64 %indvar17, 44
56 br i1 %exitcond19, label %for.body22, label %for.end33
58 for.body22: ; preds = %for.cond19
59 %tmp26 = load i32* %arrayidx25, align 4
60 store i32 %tmp26, i32* %arrayidx29, align 4
63 for.inc30: ; preds = %for.body22
64 %indvar.next18 = add i64 %indvar17, 1
67 for.end33: ; preds = %for.cond19
70 for.cond34: ; preds = %for.inc48, %for.end33
71 %indvar13 = phi i64 [ %indvar.next14, %for.inc48 ], [ 0, %for.end33 ]
72 %tmp15 = add i64 %indvar13, 20
73 %arrayidx45 = getelementptr [64 x i32]* %D, i64 0, i64 %tmp15
74 %arrayidx40 = getelementptr [64 x i32]* %A, i64 0, i64 %indvar13
75 %i.2 = trunc i64 %indvar13 to i32
76 %cmp36 = icmp slt i32 %i.2, 44
77 br i1 %cmp36, label %for.body37, label %for.end51
79 for.body37: ; preds = %for.cond34
80 %tmp41 = load i32* %arrayidx40, align 4
81 %tmp46 = load i32* %arrayidx45, align 4
82 %cmp47 = icmp eq i32 %tmp41, %tmp46
83 br i1 %cmp47, label %if.end, label %if.then
85 if.then: ; preds = %for.body37
86 call void @abort() noreturn nounwind
89 if.end: ; preds = %for.body37
92 for.inc48: ; preds = %if.end
93 %indvar.next14 = add i64 %indvar13, 1
96 for.end51: ; preds = %for.cond34
99 for.cond52: ; preds = %for.inc64, %for.end51
100 %indvar9 = phi i64 [ %indvar.next10, %for.inc64 ], [ 0, %for.end51 ]
101 %arrayidx58 = getelementptr [64 x i32]* %B, i64 0, i64 %indvar9
102 %exitcond11 = icmp ne i64 %indvar9, 16
103 br i1 %exitcond11, label %for.body55, label %for.end67
105 for.body55: ; preds = %for.cond52
106 %tmp59 = load i32* %arrayidx58, align 4
107 %add60 = add nsw i32 %tmp59, 5
108 store i32 %add60, i32* %arrayidx58, align 4
111 for.inc64: ; preds = %for.body55
112 %indvar.next10 = add i64 %indvar9, 1
115 for.end67: ; preds = %for.cond52
118 for.cond68: ; preds = %for.inc84, %for.end67
119 %indvar6 = phi i64 [ %indvar.next7, %for.inc84 ], [ 0, %for.end67 ]
120 %arrayidx78 = getelementptr [64 x i32]* %C, i64 0, i64 %indvar6
121 %arrayidx74 = getelementptr [64 x i32]* %B, i64 0, i64 %indvar6
122 %i.4 = trunc i64 %indvar6 to i32
123 %cmp70 = icmp slt i32 %i.4, 16
124 br i1 %cmp70, label %for.body71, label %for.end87
126 for.body71: ; preds = %for.cond68
127 %tmp75 = load i32* %arrayidx74, align 4
128 %tmp79 = load i32* %arrayidx78, align 4
129 %add80 = add nsw i32 %tmp79, 5
130 %cmp81 = icmp eq i32 %tmp75, %add80
131 br i1 %cmp81, label %if.end83, label %if.then82
133 if.then82: ; preds = %for.body71
134 call void @abort() noreturn nounwind
137 if.end83: ; preds = %for.body71
140 for.inc84: ; preds = %if.end83
141 %indvar.next7 = add i64 %indvar6, 1
144 for.end87: ; preds = %for.cond68
147 for.cond88: ; preds = %for.inc100, %for.end87
148 %indvar2 = phi i64 [ %indvar.next3, %for.inc100 ], [ 0, %for.end87 ]
149 %tmp4 = add i64 %indvar2, 3
150 %arrayidx99 = getelementptr [64 x i32]* %C, i64 0, i64 %tmp4
151 %arrayidx94 = getelementptr [64 x i32]* %C, i64 0, i64 %indvar2
152 %exitcond = icmp ne i64 %indvar2, 4
153 br i1 %exitcond, label %for.body91, label %for.end103
155 for.body91: ; preds = %for.cond88
156 %tmp95 = load i32* %arrayidx94, align 4
157 store i32 %tmp95, i32* %arrayidx99, align 4
160 for.inc100: ; preds = %for.body91
161 %indvar.next3 = add i64 %indvar2, 1
164 for.end103: ; preds = %for.cond88
165 br label %for.cond104
167 for.cond104: ; preds = %for.inc119, %for.end103
168 %indvar = phi i64 [ %indvar.next, %for.inc119 ], [ 0, %for.end103 ]
169 %arrayidx114 = getelementptr [64 x i32]* %E, i64 0, i64 %indvar
170 %arrayidx110 = getelementptr [64 x i32]* %C, i64 0, i64 %indvar
171 %i.6 = trunc i64 %indvar to i32
172 %cmp106 = icmp slt i32 %i.6, 4
173 br i1 %cmp106, label %for.body107, label %for.end122
175 for.body107: ; preds = %for.cond104
176 %tmp111 = load i32* %arrayidx110, align 4
177 %tmp115 = load i32* %arrayidx114, align 4
178 %cmp116 = icmp eq i32 %tmp111, %tmp115
179 br i1 %cmp116, label %if.end118, label %if.then117
181 if.then117: ; preds = %for.body107
182 call void @abort() noreturn nounwind
185 if.end118: ; preds = %for.body107
188 for.inc119: ; preds = %if.end118
189 %indvar.next = add i64 %indvar, 1
190 br label %for.cond104
192 for.end122: ; preds = %for.cond104
196 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind
198 define internal void @check_vect() nounwind uwtable noinline {
200 %a = alloca i32, align 4
201 %b = alloca i32, align 4
202 %c = alloca i32, align 4
203 %d = alloca i32, align 4
204 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
205 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
206 %tobool = icmp eq i32 %call1, 0
207 br i1 %tobool, label %if.then, label %lor.lhs.false
209 lor.lhs.false: ; preds = %entry
210 %tmp4 = load i32* %d, align 4
211 %and6 = and i32 %tmp4, 67108864
212 %cmp = icmp eq i32 %and6, 0
213 br i1 %cmp, label %if.then, label %if.end
215 if.then: ; preds = %entry, %lor.lhs.false
216 call void @exit(i32 0) noreturn nounwind
219 if.end: ; preds = %lor.lhs.false
220 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
224 declare void @abort() noreturn
226 declare void (i32)* @signal(i32, void (i32)*) nounwind
228 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
230 call void @exit(i32 0) noreturn nounwind
233 return: ; No predecessors!
237 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
239 %and = and i32 %__level, -2147483648
240 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
241 %cmp = icmp ult i32 %call, %__level
242 br i1 %cmp, label %if.then, label %if.end
244 if.then: ; preds = %entry
247 if.end: ; preds = %entry
248 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
249 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
250 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
251 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
252 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
253 store i32 %asmresult, i32* %__eax, align 4
254 store i32 %asmresult8, i32* %__ebx, align 4
255 store i32 %asmresult9, i32* %__ecx, align 4
256 store i32 %asmresult10, i32* %__edx, align 4
259 return: ; preds = %if.end, %if.then
260 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
264 declare void @exit(i32) noreturn
266 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
268 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
269 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
270 %tobool = icmp eq i32* %__sig, null
271 br i1 %tobool, label %if.end, label %if.then
273 if.then: ; preds = %entry
274 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
275 store i32 %asmresult1, i32* %__sig, align 4
278 if.end: ; preds = %entry, %if.then
282 !0 = metadata !{i32 -2147343062, i32 -2147343054}
283 !1 = metadata !{i32 -2147343185, i32 -2147343177}