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-section-anchors-vect-65.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer no-section-anchors-vect-65.s > no-section-anchors-vect-65.ll
6 ; ModuleID = 'no-section-anchors-vect-65.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 [4 x [4 x [16 x i32]]] [[4 x [16 x i32]] [[16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45]], [4 x [16 x i32]] [[16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45]], [4 x [16 x i32]] [[16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45]], [4 x [16 x i32]] [[16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45], [16 x i32] [i32 0, i32 3, i32 6, i32 9, i32 12, i32 15, i32 18, i32 21, i32 24, i32 27, i32 30, i32 33, i32 36, i32 39, i32 42, i32 45]]], align 16
11 @ia = common global [4 x [4 x [16 x i32]]] zeroinitializer, align 16
12 @ic = common global [16 x i32] zeroinitializer, align 16
14 define i32 @main1() nounwind uwtable noinline {
18 for.cond: ; preds = %for.inc18, %entry
19 %indvar15 = phi i64 [ %indvar.next16, %for.inc18 ], [ 0, %entry ]
20 %exitcond17 = icmp ne i64 %indvar15, 4
21 br i1 %exitcond17, label %for.body, label %for.end21
23 for.body: ; preds = %for.cond
26 for.cond1: ; preds = %for.inc, %for.body
27 %indvar12 = phi i64 [ %indvar.next13, %for.inc ], [ 0, %for.body ]
28 %arrayidx8 = getelementptr [4 x [4 x [16 x i32]]]* @ib, i64 0, i64 2, i64 %indvar15, i64 %indvar12
29 %arrayidx16 = getelementptr [4 x [4 x [16 x i32]]]* @ia, i64 0, i64 %indvar15, i64 1, i64 %indvar12
30 %exitcond14 = icmp ne i64 %indvar12, 16
31 br i1 %exitcond14, label %for.body4, label %for.end
33 for.body4: ; preds = %for.cond1
34 %tmp9 = load i32* %arrayidx8, align 4
35 store i32 %tmp9, i32* %arrayidx16, align 4
38 for.inc: ; preds = %for.body4
39 %indvar.next13 = add i64 %indvar12, 1
42 for.end: ; preds = %for.cond1
45 for.inc18: ; preds = %for.end
46 %indvar.next16 = add i64 %indvar15, 1
49 for.end21: ; preds = %for.cond
52 for.cond22: ; preds = %for.inc50, %for.end21
53 %indvar10 = phi i64 [ %indvar.next11, %for.inc50 ], [ 0, %for.end21 ]
54 %i.1 = trunc i64 %indvar10 to i32
55 %cmp24 = icmp slt i32 %i.1, 4
56 br i1 %cmp24, label %for.body25, label %for.end53
58 for.body25: ; preds = %for.cond22
61 for.cond26: ; preds = %for.inc46, %for.body25
62 %indvar8 = phi i64 [ %indvar.next9, %for.inc46 ], [ 0, %for.body25 ]
63 %arrayidx36 = getelementptr [4 x [4 x [16 x i32]]]* @ia, i64 0, i64 %indvar10, i64 1, i64 %indvar8
64 %arrayidx43 = getelementptr [4 x [4 x [16 x i32]]]* @ib, i64 0, i64 2, i64 %indvar10, i64 %indvar8
65 %j.1 = trunc i64 %indvar8 to i32
66 %cmp28 = icmp slt i32 %j.1, 16
67 br i1 %cmp28, label %for.body29, label %for.end49
69 for.body29: ; preds = %for.cond26
70 %tmp37 = load i32* %arrayidx36, align 4
71 %tmp44 = load i32* %arrayidx43, align 4
72 %cmp45 = icmp eq i32 %tmp37, %tmp44
73 br i1 %cmp45, label %if.end, label %if.then
75 if.then: ; preds = %for.body29
76 call void @abort() noreturn nounwind
79 if.end: ; preds = %for.body29
82 for.inc46: ; preds = %if.end
83 %indvar.next9 = add i64 %indvar8, 1
86 for.end49: ; preds = %for.cond26
89 for.inc50: ; preds = %for.end49
90 %indvar.next11 = add i64 %indvar10, 1
93 for.end53: ; preds = %for.cond22
96 for.cond54: ; preds = %for.inc76, %for.end53
97 %indvar5 = phi i64 [ %indvar.next6, %for.inc76 ], [ 0, %for.end53 ]
98 %exitcond7 = icmp ne i64 %indvar5, 4
99 br i1 %exitcond7, label %for.body57, label %for.end79
101 for.body57: ; preds = %for.cond54
104 for.cond58: ; preds = %for.inc72, %for.body57
105 %indvar3 = phi i64 [ %indvar.next4, %for.inc72 ], [ 0, %for.body57 ]
106 %arrayidx67 = getelementptr [4 x [4 x [16 x i32]]]* @ib, i64 0, i64 2, i64 %indvar5, i64 %indvar3
107 %arrayidx71 = getelementptr [16 x i32]* @ic, i64 0, i64 %indvar3
108 %exitcond = icmp ne i64 %indvar3, 16
109 br i1 %exitcond, label %for.body61, label %for.end75
111 for.body61: ; preds = %for.cond58
112 %tmp68 = load i32* %arrayidx67, align 4
113 store i32 %tmp68, i32* %arrayidx71, align 4
116 for.inc72: ; preds = %for.body61
117 %indvar.next4 = add i64 %indvar3, 1
120 for.end75: ; preds = %for.cond58
123 for.inc76: ; preds = %for.end75
124 %indvar.next6 = add i64 %indvar5, 1
127 for.end79: ; preds = %for.cond54
130 for.cond80: ; preds = %for.inc106, %for.end79
131 %indvar1 = phi i64 [ %indvar.next2, %for.inc106 ], [ 0, %for.end79 ]
132 %i.3 = trunc i64 %indvar1 to i32
133 %cmp82 = icmp slt i32 %i.3, 4
134 br i1 %cmp82, label %for.body83, label %for.end109
136 for.body83: ; preds = %for.cond80
139 for.cond84: ; preds = %for.inc102, %for.body83
140 %indvar = phi i64 [ %indvar.next, %for.inc102 ], [ 0, %for.body83 ]
141 %arrayidx97 = getelementptr [4 x [4 x [16 x i32]]]* @ib, i64 0, i64 2, i64 %indvar1, i64 %indvar
142 %arrayidx90 = getelementptr [16 x i32]* @ic, i64 0, i64 %indvar
143 %j.3 = trunc i64 %indvar to i32
144 %cmp86 = icmp slt i32 %j.3, 16
145 br i1 %cmp86, label %for.body87, label %for.end105
147 for.body87: ; preds = %for.cond84
148 %tmp91 = load i32* %arrayidx90, align 4
149 %tmp98 = load i32* %arrayidx97, align 4
150 %cmp99 = icmp eq i32 %tmp91, %tmp98
151 br i1 %cmp99, label %if.end101, label %if.then100
153 if.then100: ; preds = %for.body87
154 call void @abort() noreturn nounwind
157 if.end101: ; preds = %for.body87
160 for.inc102: ; preds = %if.end101
161 %indvar.next = add i64 %indvar, 1
164 for.end105: ; preds = %for.cond84
167 for.inc106: ; preds = %for.end105
168 %indvar.next2 = add i64 %indvar1, 1
171 for.end109: ; preds = %for.cond80
175 declare void @abort() noreturn
177 define i32 @main() nounwind uwtable {
179 call void @check_vect()
180 %call = call i32 @main1()
184 define internal void @check_vect() nounwind uwtable noinline {
186 %a = alloca i32, align 4
187 %b = alloca i32, align 4
188 %c = alloca i32, align 4
189 %d = alloca i32, align 4
190 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
191 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
192 %tobool = icmp eq i32 %call1, 0
193 br i1 %tobool, label %if.then, label %lor.lhs.false
195 lor.lhs.false: ; preds = %entry
196 %tmp4 = load i32* %d, align 4
197 %and6 = and i32 %tmp4, 67108864
198 %cmp = icmp eq i32 %and6, 0
199 br i1 %cmp, label %if.then, label %if.end
201 if.then: ; preds = %entry, %lor.lhs.false
202 call void @exit(i32 0) noreturn nounwind
205 if.end: ; preds = %lor.lhs.false
206 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
210 declare void (i32)* @signal(i32, void (i32)*) nounwind
212 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
214 call void @exit(i32 0) noreturn nounwind
217 return: ; No predecessors!
221 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
223 %and = and i32 %__level, -2147483648
224 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
225 %cmp = icmp ult i32 %call, %__level
226 br i1 %cmp, label %if.then, label %if.end
228 if.then: ; preds = %entry
231 if.end: ; preds = %entry
232 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
233 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
234 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
235 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
236 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
237 store i32 %asmresult, i32* %__eax, align 4
238 store i32 %asmresult8, i32* %__ebx, align 4
239 store i32 %asmresult9, i32* %__ecx, align 4
240 store i32 %asmresult10, i32* %__edx, align 4
243 return: ; preds = %if.end, %if.then
244 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
248 declare void @exit(i32) noreturn
250 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
252 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
253 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
254 %tobool = icmp eq i32* %__sig, null
255 br i1 %tobool, label %if.end, label %if.then
257 if.then: ; preds = %entry
258 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
259 store i32 %asmresult1, i32* %__sig, align 4
262 if.end: ; preds = %entry, %if.then
266 !0 = metadata !{i32 -2147341934, i32 -2147341926}
267 !1 = metadata !{i32 -2147342057, i32 -2147342049}