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-18.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-18.s > vect-18.ll
6 ; ModuleID = 'vect-18.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 @ib = global [64 x i32] [i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0], align 16
11 @ic = global [64 x i32] [i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0, i32 1, i32 1, i32 0, i32 0, i32 1, i32 0, i32 1, i32 0], align 16
12 @cb = global [64 x i8] c"\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00", align 16
13 @cc = global [64 x i8] c"\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00\01\01\00\00\01\00\01\00", align 16
14 @sb = global [64 x i16] [i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0], align 16
15 @sc = global [64 x i16] [i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0, i16 1, i16 1, i16 0, i16 0, i16 1, i16 0, i16 1, i16 0], align 16
16 @ia = common global [64 x i32] zeroinitializer, align 16
17 @ca = common global [64 x i8] zeroinitializer, align 16
18 @sa = common global [64 x i16] zeroinitializer, align 16
20 define i32 @main1() nounwind uwtable noinline {
24 for.cond: ; preds = %for.inc, %entry
25 %indvar14 = phi i64 [ %indvar.next15, %for.inc ], [ 0, %entry ]
26 %arrayidx9 = getelementptr [64 x i32]* @ia, i64 0, i64 %indvar14
27 %arrayidx5 = getelementptr [64 x i32]* @ic, i64 0, i64 %indvar14
28 %arrayidx = getelementptr [64 x i32]* @ib, i64 0, i64 %indvar14
29 %exitcond16 = icmp ne i64 %indvar14, 64
30 br i1 %exitcond16, label %for.body, label %for.end
32 for.body: ; preds = %for.cond
33 %tmp2 = load i32* %arrayidx, align 4
34 %tmp6 = load i32* %arrayidx5, align 4
35 %or = or i32 %tmp2, %tmp6
36 store i32 %or, i32* %arrayidx9, align 4
39 for.inc: ; preds = %for.body
40 %indvar.next15 = add i64 %indvar14, 1
43 for.end: ; preds = %for.cond
46 for.cond11: ; preds = %for.inc29, %for.end
47 %indvar12 = phi i64 [ %indvar.next13, %for.inc29 ], [ 0, %for.end ]
48 %arrayidx25 = getelementptr [64 x i32]* @ic, i64 0, i64 %indvar12
49 %arrayidx21 = getelementptr [64 x i32]* @ib, i64 0, i64 %indvar12
50 %arrayidx17 = getelementptr [64 x i32]* @ia, i64 0, i64 %indvar12
51 %i.1 = trunc i64 %indvar12 to i32
52 %cmp13 = icmp slt i32 %i.1, 64
53 br i1 %cmp13, label %for.body14, label %for.end32
55 for.body14: ; preds = %for.cond11
56 %tmp18 = load i32* %arrayidx17, align 4
57 %tmp22 = load i32* %arrayidx21, align 4
58 %tmp26 = load i32* %arrayidx25, align 4
59 %or27 = or i32 %tmp22, %tmp26
60 %cmp28 = icmp eq i32 %tmp18, %or27
61 br i1 %cmp28, label %if.end, label %if.then
63 if.then: ; preds = %for.body14
64 call void @abort() noreturn nounwind
67 if.end: ; preds = %for.body14
70 for.inc29: ; preds = %if.end
71 %indvar.next13 = add i64 %indvar12, 1
74 for.end32: ; preds = %for.cond11
77 for.cond33: ; preds = %for.inc51, %for.end32
78 %indvar9 = phi i64 [ %indvar.next10, %for.inc51 ], [ 0, %for.end32 ]
79 %arrayidx50 = getelementptr [64 x i8]* @ca, i64 0, i64 %indvar9
80 %arrayidx43 = getelementptr [64 x i8]* @cc, i64 0, i64 %indvar9
81 %arrayidx39 = getelementptr [64 x i8]* @cb, i64 0, i64 %indvar9
82 %exitcond11 = icmp ne i64 %indvar9, 64
83 br i1 %exitcond11, label %for.body36, label %for.end54
85 for.body36: ; preds = %for.cond33
86 %tmp40 = load i8* %arrayidx39, align 1
87 %tmp44 = load i8* %arrayidx43, align 1
88 %or464 = or i8 %tmp40, %tmp44
89 store i8 %or464, i8* %arrayidx50, align 1
92 for.inc51: ; preds = %for.body36
93 %indvar.next10 = add i64 %indvar9, 1
96 for.end54: ; preds = %for.cond33
99 for.cond55: ; preds = %for.inc80, %for.end54
100 %indvar7 = phi i64 [ %indvar.next8, %for.inc80 ], [ 0, %for.end54 ]
101 %arrayidx72 = getelementptr [64 x i8]* @cc, i64 0, i64 %indvar7
102 %arrayidx67 = getelementptr [64 x i8]* @cb, i64 0, i64 %indvar7
103 %arrayidx62 = getelementptr [64 x i8]* @ca, i64 0, i64 %indvar7
104 %i.3 = trunc i64 %indvar7 to i32
105 %cmp57 = icmp slt i32 %i.3, 64
106 br i1 %cmp57, label %for.body59, label %for.end83
108 for.body59: ; preds = %for.cond55
109 %tmp63 = load i8* %arrayidx62, align 1
110 %tmp68 = load i8* %arrayidx67, align 1
111 %tmp73 = load i8* %arrayidx72, align 1
112 %or753 = or i8 %tmp68, %tmp73
113 %cmp76 = icmp eq i8 %tmp63, %or753
114 br i1 %cmp76, label %if.end79, label %if.then78
116 if.then78: ; preds = %for.body59
117 call void @abort() noreturn nounwind
120 if.end79: ; preds = %for.body59
123 for.inc80: ; preds = %if.end79
124 %indvar.next8 = add i64 %indvar7, 1
127 for.end83: ; preds = %for.cond55
130 for.cond84: ; preds = %for.inc104, %for.end83
131 %indvar5 = phi i64 [ %indvar.next6, %for.inc104 ], [ 0, %for.end83 ]
132 %arrayidx103 = getelementptr [64 x i16]* @sa, i64 0, i64 %indvar5
133 %arrayidx96 = getelementptr [64 x i16]* @sc, i64 0, i64 %indvar5
134 %arrayidx91 = getelementptr [64 x i16]* @sb, i64 0, i64 %indvar5
135 %exitcond = icmp ne i64 %indvar5, 64
136 br i1 %exitcond, label %for.body88, label %for.end107
138 for.body88: ; preds = %for.cond84
139 %tmp92 = load i16* %arrayidx91, align 2
140 %tmp97 = load i16* %arrayidx96, align 2
141 %or992 = or i16 %tmp92, %tmp97
142 store i16 %or992, i16* %arrayidx103, align 2
145 for.inc104: ; preds = %for.body88
146 %indvar.next6 = add i64 %indvar5, 1
149 for.end107: ; preds = %for.cond84
150 br label %for.cond108
152 for.cond108: ; preds = %for.inc133, %for.end107
153 %indvar = phi i64 [ %indvar.next, %for.inc133 ], [ 0, %for.end107 ]
154 %arrayidx125 = getelementptr [64 x i16]* @sc, i64 0, i64 %indvar
155 %arrayidx120 = getelementptr [64 x i16]* @sb, i64 0, i64 %indvar
156 %arrayidx115 = getelementptr [64 x i16]* @sa, i64 0, i64 %indvar
157 %i.5 = trunc i64 %indvar to i32
158 %cmp110 = icmp slt i32 %i.5, 64
159 br i1 %cmp110, label %for.body112, label %for.end136
161 for.body112: ; preds = %for.cond108
162 %tmp116 = load i16* %arrayidx115, align 2
163 %tmp121 = load i16* %arrayidx120, align 2
164 %tmp126 = load i16* %arrayidx125, align 2
165 %or1281 = or i16 %tmp121, %tmp126
166 %cmp129 = icmp eq i16 %tmp116, %or1281
167 br i1 %cmp129, label %if.end132, label %if.then131
169 if.then131: ; preds = %for.body112
170 call void @abort() noreturn nounwind
173 if.end132: ; preds = %for.body112
176 for.inc133: ; preds = %if.end132
177 %indvar.next = add i64 %indvar, 1
178 br label %for.cond108
180 for.end136: ; preds = %for.cond108
184 declare void @abort() noreturn
186 define i32 @main() nounwind uwtable {
188 call void @check_vect()
189 %call = call i32 @main1()
193 define internal void @check_vect() nounwind uwtable noinline {
195 %a = alloca i32, align 4
196 %b = alloca i32, align 4
197 %c = alloca i32, align 4
198 %d = alloca i32, align 4
199 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
200 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
201 %tobool = icmp eq i32 %call1, 0
202 br i1 %tobool, label %if.then, label %lor.lhs.false
204 lor.lhs.false: ; preds = %entry
205 %tmp4 = load i32* %d, align 4
206 %and6 = and i32 %tmp4, 67108864
207 %cmp = icmp eq i32 %and6, 0
208 br i1 %cmp, label %if.then, label %if.end
210 if.then: ; preds = %entry, %lor.lhs.false
211 call void @exit(i32 0) noreturn nounwind
214 if.end: ; preds = %lor.lhs.false
215 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
219 declare void (i32)* @signal(i32, void (i32)*) nounwind
221 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
223 call void @exit(i32 0) noreturn nounwind
226 return: ; No predecessors!
230 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
232 %and = and i32 %__level, -2147483648
233 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
234 %cmp = icmp ult i32 %call, %__level
235 br i1 %cmp, label %if.then, label %if.end
237 if.then: ; preds = %entry
240 if.end: ; preds = %entry
241 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
242 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
243 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
244 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
245 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
246 store i32 %asmresult, i32* %__eax, align 4
247 store i32 %asmresult8, i32* %__ebx, align 4
248 store i32 %asmresult9, i32* %__ecx, align 4
249 store i32 %asmresult10, i32* %__edx, align 4
252 return: ; preds = %if.end, %if.then
253 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
257 declare void @exit(i32) noreturn
259 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
261 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
262 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
263 %tobool = icmp eq i32* %__sig, null
264 br i1 %tobool, label %if.end, label %if.then
266 if.then: ; preds = %entry
267 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
268 store i32 %asmresult1, i32* %__sig, align 4
271 if.end: ; preds = %entry, %if.then
275 !0 = metadata !{i32 -2147342028, i32 -2147342020}
276 !1 = metadata !{i32 -2147342151, i32 -2147342143}