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-68.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-68.s > vect-68.ll
6 ; ModuleID = 'vect-68.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 %struct.test1 = type { %struct.s, i32, i32, %struct.s }
11 %struct.s = type { i32, [32 x [32 x [32 x i32]]] }
13 define i32 @main1() nounwind uwtable noinline {
15 %tmp1 = alloca %struct.test1, align 4
18 for.cond: ; preds = %for.inc, %entry
19 %indvar27 = phi i64 [ %indvar.next28, %for.inc ], [ 0, %entry ]
20 %arrayidx4 = getelementptr %struct.test1* %tmp1, i64 0, i32 0, i32 1, i64 1, i64 2, i64 %indvar27
21 %exitcond29 = icmp ne i64 %indvar27, 32
22 br i1 %exitcond29, label %for.body, label %for.end
24 for.body: ; preds = %for.cond
25 store i32 5, i32* %arrayidx4, align 4
28 for.inc: ; preds = %for.body
29 %indvar.next28 = add i64 %indvar27, 1
32 for.end: ; preds = %for.cond
35 for.cond6: ; preds = %for.inc19, %for.end
36 %indvar24 = phi i64 [ %indvar.next25, %for.inc19 ], [ 0, %for.end ]
37 %arrayidx16 = getelementptr %struct.test1* %tmp1, i64 0, i32 0, i32 1, i64 1, i64 2, i64 %indvar24
38 %i.1 = trunc i64 %indvar24 to i32
39 %cmp8 = icmp slt i32 %i.1, 32
40 br i1 %cmp8, label %for.body9, label %for.end22
42 for.body9: ; preds = %for.cond6
43 %tmp17 = load i32* %arrayidx16, align 4
44 %cmp18 = icmp eq i32 %tmp17, 5
45 br i1 %cmp18, label %if.end, label %if.then
47 if.then: ; preds = %for.body9
48 call void @abort() noreturn nounwind
51 if.end: ; preds = %for.body9
54 for.inc19: ; preds = %if.end
55 %indvar.next25 = add i64 %indvar24, 1
58 for.end22: ; preds = %for.cond6
61 for.cond23: ; preds = %for.inc34, %for.end22
62 %indvar19 = phi i64 [ %indvar.next20, %for.inc34 ], [ 0, %for.end22 ]
63 %tmp22 = add i64 %indvar19, 3
64 %arrayidx33 = getelementptr %struct.test1* %tmp1, i64 0, i32 0, i32 1, i64 1, i64 2, i64 %tmp22
65 %exitcond21 = icmp ne i64 %indvar19, 28
66 br i1 %exitcond21, label %for.body26, label %for.end37
68 for.body26: ; preds = %for.cond23
69 store i32 6, i32* %arrayidx33, align 4
72 for.inc34: ; preds = %for.body26
73 %indvar.next20 = add i64 %indvar19, 1
76 for.end37: ; preds = %for.cond23
79 for.cond38: ; preds = %for.inc53, %for.end37
80 %indvar14 = phi i64 [ %indvar.next15, %for.inc53 ], [ 0, %for.end37 ]
81 %tmp16 = add i64 %indvar14, 3
82 %arrayidx48 = getelementptr %struct.test1* %tmp1, i64 0, i32 0, i32 1, i64 1, i64 2, i64 %tmp16
83 %i.3 = trunc i64 %tmp16 to i32
84 %cmp40 = icmp slt i32 %i.3, 31
85 br i1 %cmp40, label %for.body41, label %for.end56
87 for.body41: ; preds = %for.cond38
88 %tmp49 = load i32* %arrayidx48, align 4
89 %cmp50 = icmp eq i32 %tmp49, 6
90 br i1 %cmp50, label %if.end52, label %if.then51
92 if.then51: ; preds = %for.body41
93 call void @abort() noreturn nounwind
96 if.end52: ; preds = %for.body41
99 for.inc53: ; preds = %if.end52
100 %indvar.next15 = add i64 %indvar14, 1
103 for.end56: ; preds = %for.cond38
106 for.cond57: ; preds = %for.inc67, %for.end56
107 %indvar10 = phi i64 [ %indvar.next11, %for.inc67 ], [ 0, %for.end56 ]
108 %arrayidx66 = getelementptr %struct.test1* %tmp1, i64 0, i32 3, i32 1, i64 1, i64 2, i64 %indvar10
109 %exitcond12 = icmp ne i64 %indvar10, 32
110 br i1 %exitcond12, label %for.body60, label %for.end70
112 for.body60: ; preds = %for.cond57
113 store i32 7, i32* %arrayidx66, align 4
116 for.inc67: ; preds = %for.body60
117 %indvar.next11 = add i64 %indvar10, 1
120 for.end70: ; preds = %for.cond57
123 for.cond71: ; preds = %for.inc86, %for.end70
124 %indvar7 = phi i64 [ %indvar.next8, %for.inc86 ], [ 0, %for.end70 ]
125 %arrayidx81 = getelementptr %struct.test1* %tmp1, i64 0, i32 3, i32 1, i64 1, i64 2, i64 %indvar7
126 %i.5 = trunc i64 %indvar7 to i32
127 %cmp73 = icmp slt i32 %i.5, 32
128 br i1 %cmp73, label %for.body74, label %for.end89
130 for.body74: ; preds = %for.cond71
131 %tmp82 = load i32* %arrayidx81, align 4
132 %cmp83 = icmp eq i32 %tmp82, 7
133 br i1 %cmp83, label %if.end85, label %if.then84
135 if.then84: ; preds = %for.body74
136 call void @abort() noreturn nounwind
139 if.end85: ; preds = %for.body74
142 for.inc86: ; preds = %if.end85
143 %indvar.next8 = add i64 %indvar7, 1
146 for.end89: ; preds = %for.cond71
149 for.cond90: ; preds = %for.inc101, %for.end89
150 %indvar3 = phi i64 [ %indvar.next4, %for.inc101 ], [ 0, %for.end89 ]
151 %tmp5 = add i64 %indvar3, 3
152 %arrayidx100 = getelementptr %struct.test1* %tmp1, i64 0, i32 3, i32 1, i64 1, i64 2, i64 %tmp5
153 %exitcond = icmp ne i64 %indvar3, 26
154 br i1 %exitcond, label %for.body93, label %for.end104
156 for.body93: ; preds = %for.cond90
157 store i32 8, i32* %arrayidx100, align 4
160 for.inc101: ; preds = %for.body93
161 %indvar.next4 = add i64 %indvar3, 1
164 for.end104: ; preds = %for.cond90
165 br label %for.cond105
167 for.cond105: ; preds = %for.inc120, %for.end104
168 %indvar = phi i64 [ %indvar.next, %for.inc120 ], [ 0, %for.end104 ]
169 %tmp = add i64 %indvar, 3
170 %arrayidx115 = getelementptr %struct.test1* %tmp1, i64 0, i32 3, i32 1, i64 1, i64 2, i64 %tmp
171 %i.7 = trunc i64 %tmp to i32
172 %cmp107 = icmp slt i32 %i.7, 29
173 br i1 %cmp107, label %for.body108, label %for.end123
175 for.body108: ; preds = %for.cond105
176 %tmp116 = load i32* %arrayidx115, align 4
177 %cmp117 = icmp eq i32 %tmp116, 8
178 br i1 %cmp117, label %if.end119, label %if.then118
180 if.then118: ; preds = %for.body108
181 call void @abort() noreturn nounwind
184 if.end119: ; preds = %for.body108
187 for.inc120: ; preds = %if.end119
188 %indvar.next = add i64 %indvar, 1
189 br label %for.cond105
191 for.end123: ; preds = %for.cond105
195 declare void @abort() noreturn
197 define i32 @main() nounwind uwtable {
199 call void @check_vect()
200 %call = call i32 @main1()
204 define internal void @check_vect() nounwind uwtable noinline {
206 %a = alloca i32, align 4
207 %b = alloca i32, align 4
208 %c = alloca i32, align 4
209 %d = alloca i32, align 4
210 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
211 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
212 %tobool = icmp eq i32 %call1, 0
213 br i1 %tobool, label %if.then, label %lor.lhs.false
215 lor.lhs.false: ; preds = %entry
216 %tmp4 = load i32* %d, align 4
217 %and6 = and i32 %tmp4, 67108864
218 %cmp = icmp eq i32 %and6, 0
219 br i1 %cmp, label %if.then, label %if.end
221 if.then: ; preds = %entry, %lor.lhs.false
222 call void @exit(i32 0) noreturn nounwind
225 if.end: ; preds = %lor.lhs.false
226 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
230 declare void (i32)* @signal(i32, void (i32)*) nounwind
232 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
234 call void @exit(i32 0) noreturn nounwind
237 return: ; No predecessors!
241 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
243 %and = and i32 %__level, -2147483648
244 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
245 %cmp = icmp ult i32 %call, %__level
246 br i1 %cmp, label %if.then, label %if.end
248 if.then: ; preds = %entry
251 if.end: ; preds = %entry
252 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
253 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
254 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
255 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
256 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
257 store i32 %asmresult, i32* %__eax, align 4
258 store i32 %asmresult8, i32* %__ebx, align 4
259 store i32 %asmresult9, i32* %__ecx, align 4
260 store i32 %asmresult10, i32* %__edx, align 4
263 return: ; preds = %if.end, %if.then
264 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
268 declare void @exit(i32) noreturn
270 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
272 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
273 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
274 %tobool = icmp eq i32* %__sig, null
275 br i1 %tobool, label %if.end, label %if.then
277 if.then: ; preds = %entry
278 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
279 store i32 %asmresult1, i32* %__sig, align 4
282 if.end: ; preds = %entry, %if.then
286 !0 = metadata !{i32 -2147342960, i32 -2147342952}
287 !1 = metadata !{i32 -2147343083, i32 -2147343075}