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-outer-4h.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer no-section-anchors-vect-outer-4h.s > no-section-anchors-vect-outer-4h.ll
6 ; ModuleID = 'no-section-anchors-vect-outer-4h.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 @a = common global [128 x [40 x i16]] zeroinitializer, align 16
11 @out = common global [40 x i32] zeroinitializer, align 16
13 define void @foo() nounwind uwtable noinline {
17 for.cond: ; preds = %for.inc13, %entry
18 %indvar1 = phi i64 [ %indvar.next2, %for.inc13 ], [ 0, %entry ]
19 %arrayidx12 = getelementptr [40 x i32]* @out, i64 0, i64 %indvar1
20 %exitcond3 = icmp ne i64 %indvar1, 40
21 br i1 %exitcond3, label %for.body, label %for.end16
23 for.body: ; preds = %for.cond
26 for.cond1: ; preds = %for.inc, %for.body
27 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %for.body ]
28 %arrayidx8 = getelementptr [128 x [40 x i16]]* @a, i64 0, i64 %indvar, i64 %indvar1
29 %exitcond = icmp ne i64 %indvar, 128
30 br i1 %exitcond, label %for.body4, label %for.end
32 for.body4: ; preds = %for.cond1
33 store i16 4, i16* %arrayidx8, align 2
36 for.inc: ; preds = %for.body4
37 %indvar.next = add i64 %indvar, 1
40 for.end: ; preds = %for.cond1
41 store i32 5, i32* %arrayidx12, align 4
44 for.inc13: ; preds = %for.end
45 %indvar.next2 = add i64 %indvar1, 1
48 for.end16: ; preds = %for.cond
52 define i32 @main() nounwind uwtable {
54 call void @check_vect()
58 for.cond: ; preds = %for.inc21, %entry
59 %indvar1 = phi i64 [ %indvar.next2, %for.inc21 ], [ 0, %entry ]
60 %arrayidx15 = getelementptr [40 x i32]* @out, i64 0, i64 %indvar1
61 %i.0 = trunc i64 %indvar1 to i32
62 %cmp = icmp slt i32 %i.0, 40
63 br i1 %cmp, label %for.body, label %for.end24
65 for.body: ; preds = %for.cond
68 for.cond1: ; preds = %for.inc, %for.body
69 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %for.body ]
70 %arrayidx8 = getelementptr [128 x [40 x i16]]* @a, i64 0, i64 %indvar, i64 %indvar1
71 %j.0 = trunc i64 %indvar to i32
72 %cmp3 = icmp slt i32 %j.0, 128
73 br i1 %cmp3, label %for.body4, label %for.end
75 for.body4: ; preds = %for.cond1
76 %tmp9 = load i16* %arrayidx8, align 2
77 %cmp10 = icmp eq i16 %tmp9, 4
78 br i1 %cmp10, label %if.end, label %if.then
80 if.then: ; preds = %for.body4
81 call void @abort() noreturn nounwind
84 if.end: ; preds = %for.body4
87 for.inc: ; preds = %if.end
88 %indvar.next = add i64 %indvar, 1
91 for.end: ; preds = %for.cond1
92 %tmp16 = load i32* %arrayidx15, align 4
93 %cmp17 = icmp eq i32 %tmp16, 5
94 br i1 %cmp17, label %if.end20, label %if.then19
96 if.then19: ; preds = %for.end
97 call void @abort() noreturn nounwind
100 if.end20: ; preds = %for.end
103 for.inc21: ; preds = %if.end20
104 %indvar.next2 = add i64 %indvar1, 1
107 for.end24: ; preds = %for.cond
111 define internal void @check_vect() nounwind uwtable noinline {
113 %a = alloca i32, align 4
114 %b = alloca i32, align 4
115 %c = alloca i32, align 4
116 %d = alloca i32, align 4
117 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
118 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
119 %tobool = icmp eq i32 %call1, 0
120 br i1 %tobool, label %if.then, label %lor.lhs.false
122 lor.lhs.false: ; preds = %entry
123 %tmp4 = load i32* %d, align 4
124 %and6 = and i32 %tmp4, 67108864
125 %cmp = icmp eq i32 %and6, 0
126 br i1 %cmp, label %if.then, label %if.end
128 if.then: ; preds = %entry, %lor.lhs.false
129 call void @exit(i32 0) noreturn nounwind
132 if.end: ; preds = %lor.lhs.false
133 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
137 declare void @abort() noreturn
139 declare void (i32)* @signal(i32, void (i32)*) nounwind
141 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
143 call void @exit(i32 0) noreturn nounwind
146 return: ; No predecessors!
150 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
152 %and = and i32 %__level, -2147483648
153 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
154 %cmp = icmp ult i32 %call, %__level
155 br i1 %cmp, label %if.then, label %if.end
157 if.then: ; preds = %entry
160 if.end: ; preds = %entry
161 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
162 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
163 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
164 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
165 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
166 store i32 %asmresult, i32* %__eax, align 4
167 store i32 %asmresult8, i32* %__ebx, align 4
168 store i32 %asmresult9, i32* %__ecx, align 4
169 store i32 %asmresult10, i32* %__edx, align 4
172 return: ; preds = %if.end, %if.then
173 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
177 declare void @exit(i32) noreturn
179 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
181 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
182 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
183 %tobool = icmp eq i32* %__sig, null
184 br i1 %tobool, label %if.end, label %if.then
186 if.then: ; preds = %entry
187 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
188 store i32 %asmresult1, i32* %__sig, align 4
191 if.end: ; preds = %entry, %if.then
195 !0 = metadata !{i32 -2147343599, i32 -2147343591}
196 !1 = metadata !{i32 -2147343722, i32 -2147343714}