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-70.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-70.s > vect-70.ll
6 ; ModuleID = 'vect-70.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, [24 x %struct.s] }
11 %struct.s = type { i32, [24 x [24 x [24 x i32]]] }
13 define i32 @main1() nounwind uwtable noinline {
15 %tmp1 = alloca %struct.test1, align 4
18 for.cond: ; preds = %for.inc12, %entry
19 %indvar23 = phi i64 [ %indvar.next24, %for.inc12 ], [ 0, %entry ]
20 %exitcond27 = icmp ne i64 %indvar23, 24
21 br i1 %exitcond27, label %for.body, label %for.end15
23 for.body: ; preds = %for.cond
26 for.cond1: ; preds = %for.inc, %for.body
27 %indvar20 = phi i64 [ %indvar.next21, %for.inc ], [ 0, %for.body ]
28 %tmp28 = add i64 %indvar20, 3
29 %arrayidx10 = getelementptr %struct.test1* %tmp1, i64 0, i32 3, i64 %indvar23, i32 1, i64 1, i64 2, i64 %tmp28
30 %exitcond22 = icmp ne i64 %indvar20, 18
31 br i1 %exitcond22, label %for.body4, label %for.end
33 for.body4: ; preds = %for.cond1
34 store i32 8, i32* %arrayidx10, align 4
37 for.inc: ; preds = %for.body4
38 %indvar.next21 = add i64 %indvar20, 1
41 for.end: ; preds = %for.cond1
44 for.inc12: ; preds = %for.end
45 %indvar.next24 = add i64 %indvar23, 1
48 for.end15: ; preds = %for.cond
51 for.cond16: ; preds = %for.inc40, %for.end15
52 %indvar14 = phi i64 [ %indvar.next15, %for.inc40 ], [ 0, %for.end15 ]
53 %i.1 = trunc i64 %indvar14 to i32
54 %cmp18 = icmp slt i32 %i.1, 24
55 br i1 %cmp18, label %for.body19, label %for.end43
57 for.body19: ; preds = %for.cond16
60 for.cond20: ; preds = %for.inc36, %for.body19
61 %indvar12 = phi i64 [ %indvar.next13, %for.inc36 ], [ 0, %for.body19 ]
62 %tmp18 = add i64 %indvar12, 3
63 %arrayidx33 = getelementptr %struct.test1* %tmp1, i64 0, i32 3, i64 %indvar14, i32 1, i64 1, i64 2, i64 %tmp18
64 %tmp16 = add i64 %indvar12, 3
65 %j.1 = trunc i64 %tmp16 to i32
66 %cmp22 = icmp slt i32 %j.1, 21
67 br i1 %cmp22, label %for.body23, label %for.end39
69 for.body23: ; preds = %for.cond20
70 %tmp34 = load i32* %arrayidx33, align 4
71 %cmp35 = icmp eq i32 %tmp34, 8
72 br i1 %cmp35, label %if.end, label %if.then
74 if.then: ; preds = %for.body23
75 call void @abort() noreturn nounwind
78 if.end: ; preds = %for.body23
81 for.inc36: ; preds = %if.end
82 %indvar.next13 = add i64 %indvar12, 1
85 for.end39: ; preds = %for.cond20
88 for.inc40: ; preds = %for.end39
89 %indvar.next15 = add i64 %indvar14, 1
92 for.end43: ; preds = %for.cond16
95 for.cond44: ; preds = %for.inc66, %for.end43
96 %tmp30 = phi i32 [ 0, %for.end43 ], [ %inc68, %for.inc66 ]
97 %exitcond11 = icmp ne i32 %tmp30, 24
98 br i1 %exitcond11, label %for.body47, label %for.end69
100 for.body47: ; preds = %for.cond44
103 for.cond48: ; preds = %for.inc62, %for.body47
104 %indvar5 = phi i64 [ %indvar.next6, %for.inc62 ], [ 0, %for.body47 ]
105 %tmp7 = mul i64 %indvar5, 13826
106 %tmp8 = add i64 %tmp7, 3
107 %arrayidx61 = getelementptr %struct.test1* %tmp1, i64 0, i32 3, i64 3, i32 1, i64 1, i64 2, i64 %tmp8
108 %exitcond = icmp ne i64 %indvar5, 18
109 br i1 %exitcond, label %for.body51, label %for.end65
111 for.body51: ; preds = %for.cond48
112 store i32 8, i32* %arrayidx61, align 4
115 for.inc62: ; preds = %for.body51
116 %indvar.next6 = add i64 %indvar5, 1
119 for.end65: ; preds = %for.cond48
122 for.inc66: ; preds = %for.end65
123 %inc68 = add nsw i32 %tmp30, 1
126 for.end69: ; preds = %for.cond44
129 for.cond70: ; preds = %for.inc96, %for.end69
130 %tmp31 = phi i32 [ 0, %for.end69 ], [ %inc98, %for.inc96 ]
131 %cmp72 = icmp slt i32 %tmp31, 24
132 br i1 %cmp72, label %for.body73, label %for.end99
134 for.body73: ; preds = %for.cond70
137 for.cond74: ; preds = %for.inc92, %for.body73
138 %indvar = phi i64 [ %indvar.next, %for.inc92 ], [ 0, %for.body73 ]
139 %tmp = mul i64 %indvar, 13826
140 %tmp2 = add i64 %tmp, 3
141 %arrayidx87 = getelementptr %struct.test1* %tmp1, i64 0, i32 3, i64 3, i32 1, i64 1, i64 2, i64 %tmp2
142 %idxprom79 = add i64 %indvar, 3
143 %j.3 = trunc i64 %idxprom79 to i32
144 %cmp76 = icmp slt i32 %j.3, 21
145 br i1 %cmp76, label %for.body77, label %for.end95
147 for.body77: ; preds = %for.cond74
148 %tmp88 = load i32* %arrayidx87, align 4
149 %cmp89 = icmp eq i32 %tmp88, 8
150 br i1 %cmp89, label %if.end91, label %if.then90
152 if.then90: ; preds = %for.body77
153 call void @abort() noreturn nounwind
156 if.end91: ; preds = %for.body77
159 for.inc92: ; preds = %if.end91
160 %indvar.next = add i64 %indvar, 1
163 for.end95: ; preds = %for.cond74
166 for.inc96: ; preds = %for.end95
167 %inc98 = add nsw i32 %tmp31, 1
170 for.end99: ; preds = %for.cond70
174 declare void @abort() noreturn
176 define i32 @main() nounwind uwtable {
178 call void @check_vect()
179 %call = call i32 @main1()
183 define internal void @check_vect() nounwind uwtable noinline {
185 %a = alloca i32, align 4
186 %b = alloca i32, align 4
187 %c = alloca i32, align 4
188 %d = alloca i32, align 4
189 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
190 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
191 %tobool = icmp eq i32 %call1, 0
192 br i1 %tobool, label %if.then, label %lor.lhs.false
194 lor.lhs.false: ; preds = %entry
195 %tmp4 = load i32* %d, align 4
196 %and6 = and i32 %tmp4, 67108864
197 %cmp = icmp eq i32 %and6, 0
198 br i1 %cmp, label %if.then, label %if.end
200 if.then: ; preds = %entry, %lor.lhs.false
201 call void @exit(i32 0) noreturn nounwind
204 if.end: ; preds = %lor.lhs.false
205 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
209 declare void (i32)* @signal(i32, void (i32)*) nounwind
211 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
213 call void @exit(i32 0) noreturn nounwind
216 return: ; No predecessors!
220 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
222 %and = and i32 %__level, -2147483648
223 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
224 %cmp = icmp ult i32 %call, %__level
225 br i1 %cmp, label %if.then, label %if.end
227 if.then: ; preds = %entry
230 if.end: ; preds = %entry
231 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
232 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
233 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
234 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
235 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
236 store i32 %asmresult, i32* %__eax, align 4
237 store i32 %asmresult8, i32* %__ebx, align 4
238 store i32 %asmresult9, i32* %__ecx, align 4
239 store i32 %asmresult10, i32* %__edx, align 4
242 return: ; preds = %if.end, %if.then
243 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
247 declare void @exit(i32) noreturn
249 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
251 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
252 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
253 %tobool = icmp eq i32* %__sig, null
254 br i1 %tobool, label %if.end, label %if.then
256 if.then: ; preds = %entry
257 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
258 store i32 %asmresult1, i32* %__sig, align 4
261 if.end: ; preds = %entry, %if.then
265 !0 = metadata !{i32 -2147342824, i32 -2147342816}
266 !1 = metadata !{i32 -2147342947, i32 -2147342939}