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-35.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer slp-35.s > slp-35.ll
6 ; ModuleID = 'slp-35.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.s = type { i32, i32, i32, i32, i32 }
12 define i32 @main1(%struct.s* %arr) nounwind uwtable {
14 %res = alloca [128 x %struct.s], align 16
17 for.cond: ; preds = %for.inc, %entry
18 %indvar6 = phi i64 [ %indvar.next7, %for.inc ], [ 0, %entry ]
19 %e49 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar6, i32 4
20 %b39 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar6, i32 1
21 %d29 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar6, i32 3
22 %scevgep11 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar6
23 %a19 = bitcast %struct.s* %scevgep11 to i32*
24 %c9 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar6, i32 2
25 %e = getelementptr %struct.s* %arr, i64 %indvar6, i32 4
26 %b = getelementptr %struct.s* %arr, i64 %indvar6, i32 1
27 %d = getelementptr %struct.s* %arr, i64 %indvar6, i32 3
28 %scevgep17 = getelementptr %struct.s* %arr, i64 %indvar6
29 %a = bitcast %struct.s* %scevgep17 to i32*
30 %c = getelementptr %struct.s* %arr, i64 %indvar6, i32 2
31 %exitcond = icmp ne i64 %indvar6, 128
32 br i1 %exitcond, label %for.body, label %for.end
34 for.body: ; preds = %for.cond
35 %tmp4 = load i32* %c, align 4
36 %add = shl nsw i32 %tmp4, 1
37 store i32 %add, i32* %c9, align 4
38 %tmp11 = load i32* %a, align 4
39 %add15 = shl nsw i32 %tmp11, 1
40 store i32 %add15, i32* %a19, align 4
41 %tmp21 = load i32* %d, align 4
42 %add25 = shl nsw i32 %tmp21, 1
43 store i32 %add25, i32* %d29, align 4
44 %tmp31 = load i32* %b, align 4
45 %add35 = shl nsw i32 %tmp31, 1
46 store i32 %add35, i32* %b39, align 4
47 %tmp41 = load i32* %e, align 4
48 %add45 = shl nsw i32 %tmp41, 1
49 store i32 %add45, i32* %e49, align 4
52 for.inc: ; preds = %for.body
53 %indvar.next7 = add i64 %indvar6, 1
56 for.end: ; preds = %for.cond
59 for.cond52: ; preds = %for.inc154, %for.end
60 %indvar = phi i64 [ %indvar.next, %for.inc154 ], [ 0, %for.end ]
61 %e144 = getelementptr %struct.s* %arr, i64 %indvar, i32 4
62 %e138 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar, i32 4
63 %b124 = getelementptr %struct.s* %arr, i64 %indvar, i32 1
64 %b118 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar, i32 1
65 %d104 = getelementptr %struct.s* %arr, i64 %indvar, i32 3
66 %d98 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar, i32 3
67 %scevgep = getelementptr %struct.s* %arr, i64 %indvar
68 %a84 = bitcast %struct.s* %scevgep to i32*
69 %scevgep2 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar
70 %a78 = bitcast %struct.s* %scevgep2 to i32*
71 %c65 = getelementptr %struct.s* %arr, i64 %indvar, i32 2
72 %c59 = getelementptr [128 x %struct.s]* %res, i64 0, i64 %indvar, i32 2
73 %i.1 = trunc i64 %indvar to i32
74 %cmp54 = icmp slt i32 %i.1, 128
75 br i1 %cmp54, label %for.body55, label %for.end157
77 for.body55: ; preds = %for.cond52
78 %tmp60 = load i32* %c59, align 4
79 %tmp66 = load i32* %c65, align 4
80 %tmp72 = load i32* %c65, align 4
81 %add73 = add nsw i32 %tmp66, %tmp72
82 %cmp74 = icmp eq i32 %tmp60, %add73
83 br i1 %cmp74, label %lor.lhs.false, label %if.then
85 lor.lhs.false: ; preds = %for.body55
86 %tmp79 = load i32* %a78, align 4
87 %tmp85 = load i32* %a84, align 4
88 %tmp91 = load i32* %a84, align 4
89 %add92 = add nsw i32 %tmp85, %tmp91
90 %cmp93 = icmp eq i32 %tmp79, %add92
91 br i1 %cmp93, label %lor.lhs.false94, label %if.then
93 lor.lhs.false94: ; preds = %lor.lhs.false
94 %tmp99 = load i32* %d98, align 4
95 %tmp105 = load i32* %d104, align 4
96 %tmp111 = load i32* %d104, align 4
97 %add112 = add nsw i32 %tmp105, %tmp111
98 %cmp113 = icmp eq i32 %tmp99, %add112
99 br i1 %cmp113, label %lor.lhs.false114, label %if.then
101 lor.lhs.false114: ; preds = %lor.lhs.false94
102 %tmp119 = load i32* %b118, align 4
103 %tmp125 = load i32* %b124, align 4
104 %tmp131 = load i32* %b124, align 4
105 %add132 = add nsw i32 %tmp125, %tmp131
106 %cmp133 = icmp eq i32 %tmp119, %add132
107 br i1 %cmp133, label %lor.lhs.false134, label %if.then
109 lor.lhs.false134: ; preds = %lor.lhs.false114
110 %tmp139 = load i32* %e138, align 4
111 %tmp145 = load i32* %e144, align 4
112 %tmp151 = load i32* %e144, align 4
113 %add152 = add nsw i32 %tmp145, %tmp151
114 %cmp153 = icmp eq i32 %tmp139, %add152
115 br i1 %cmp153, label %if.end, label %if.then
117 if.then: ; preds = %lor.lhs.false134, %lor.lhs.false114, %lor.lhs.false94, %lor.lhs.false, %for.body55
118 call void @abort() noreturn nounwind
121 if.end: ; preds = %lor.lhs.false134
124 for.inc154: ; preds = %if.end
125 %indvar.next = add i64 %indvar, 1
128 for.end157: ; preds = %for.cond52
132 declare void @abort() noreturn
134 define i32 @main() nounwind uwtable {
136 %arr = alloca [128 x %struct.s], align 16
137 call void @check_vect()
140 for.cond: ; preds = %for.inc, %entry
141 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
142 %tmp = mul i64 %indvar, 2
143 %mul = trunc i64 %tmp to i32
144 %scevgep = getelementptr [128 x %struct.s]* %arr, i64 0, i64 %indvar
145 %a = bitcast %struct.s* %scevgep to i32*
146 %e = getelementptr [128 x %struct.s]* %arr, i64 0, i64 %indvar, i32 4
147 %tmp4 = mul i64 %indvar, 3
148 %tmp5 = add i64 %tmp4, 5
149 %add16 = trunc i64 %tmp5 to i32
150 %d = getelementptr [128 x %struct.s]* %arr, i64 0, i64 %indvar, i32 3
151 %tmp8 = add i64 %indvar, 34
152 %add = trunc i64 %tmp8 to i32
153 %c = getelementptr [128 x %struct.s]* %arr, i64 0, i64 %indvar, i32 2
154 %b = getelementptr [128 x %struct.s]* %arr, i64 0, i64 %indvar, i32 1
155 %i.0 = trunc i64 %indvar to i32
156 %cmp = icmp slt i32 %i.0, 128
157 br i1 %cmp, label %for.body, label %for.end
159 for.body: ; preds = %for.cond
160 store i32 %i.0, i32* %a, align 4
161 store i32 %mul, i32* %b, align 4
162 store i32 17, i32* %c, align 4
163 store i32 %add, i32* %d, align 4
164 store i32 %add16, i32* %e, align 4
165 %tmp24 = load i32* %a, align 4
166 %cmp25 = icmp eq i32 %tmp24, 178
167 br i1 %cmp25, label %if.then, label %if.end
169 if.then: ; preds = %for.body
170 call void @abort() noreturn nounwind
173 if.end: ; preds = %for.body
176 for.inc: ; preds = %if.end
177 %indvar.next = add i64 %indvar, 1
180 for.end: ; preds = %for.cond
181 %arraydecay = getelementptr inbounds [128 x %struct.s]* %arr, i64 0, i64 0
182 %call = call i32 @main1(%struct.s* %arraydecay)
186 define internal void @check_vect() nounwind uwtable noinline {
188 %a = alloca i32, align 4
189 %b = alloca i32, align 4
190 %c = alloca i32, align 4
191 %d = alloca i32, align 4
192 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
193 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
194 %tobool = icmp eq i32 %call1, 0
195 br i1 %tobool, label %if.then, label %lor.lhs.false
197 lor.lhs.false: ; preds = %entry
198 %tmp4 = load i32* %d, align 4
199 %and6 = and i32 %tmp4, 67108864
200 %cmp = icmp eq i32 %and6, 0
201 br i1 %cmp, label %if.then, label %if.end
203 if.then: ; preds = %entry, %lor.lhs.false
204 call void @exit(i32 0) noreturn nounwind
207 if.end: ; preds = %lor.lhs.false
208 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
212 declare void (i32)* @signal(i32, void (i32)*) nounwind
214 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
216 call void @exit(i32 0) noreturn nounwind
219 return: ; No predecessors!
223 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
225 %and = and i32 %__level, -2147483648
226 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
227 %cmp = icmp ult i32 %call, %__level
228 br i1 %cmp, label %if.then, label %if.end
230 if.then: ; preds = %entry
233 if.end: ; preds = %entry
234 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
235 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
236 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
237 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
238 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
239 store i32 %asmresult, i32* %__eax, align 4
240 store i32 %asmresult8, i32* %__ebx, align 4
241 store i32 %asmresult9, i32* %__ecx, align 4
242 store i32 %asmresult10, i32* %__edx, align 4
245 return: ; preds = %if.end, %if.then
246 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
250 declare void @exit(i32) noreturn
252 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
254 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
255 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
256 %tobool = icmp eq i32* %__sig, null
257 br i1 %tobool, label %if.end, label %if.then
259 if.then: ; preds = %entry
260 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
261 store i32 %asmresult1, i32* %__sig, align 4
264 if.end: ; preds = %entry, %if.then
268 !0 = metadata !{i32 -2147343010, i32 -2147343002}
269 !1 = metadata !{i32 -2147343133, i32 -2147343125}