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-115.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-115.s > vect-115.ll
6 ; ModuleID = 'vect-115.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.t, %struct.t*, i32, i32 }
11 %struct.t = type { %struct.s, i32 }
12 %struct.s = type { [16 x i32], [16 x i32], i32 }
14 @a = global [16 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15], align 16
16 define i32 @main1() nounwind uwtable noinline {
18 %tmp1 = alloca %struct.test1, align 8
19 %tmp2 = alloca %struct.t, align 4
20 %ptr_t = getelementptr inbounds %struct.test1* %tmp1, i64 0, i32 1
21 store %struct.t* %tmp2, %struct.t** %ptr_t, align 8
24 for.cond: ; preds = %for.inc, %entry
25 %indvar5 = phi i64 [ %indvar.next6, %for.inc ], [ 0, %entry ]
26 %arrayidx7 = getelementptr %struct.test1* %tmp1, i64 0, i32 0, i32 0, i32 0, i64 %indvar5
27 %arrayidx = getelementptr [16 x i32]* @a, i64 0, i64 %indvar5
28 %exitcond7 = icmp ne i64 %indvar5, 16
29 br i1 %exitcond7, label %for.body, label %for.end
31 for.body: ; preds = %for.cond
32 %tmp4 = load i32* %arrayidx, align 4
33 store i32 %tmp4, i32* %arrayidx7, align 4
36 for.inc: ; preds = %for.body
37 %indvar.next6 = add i64 %indvar5, 1
40 for.end: ; preds = %for.cond
43 for.cond9: ; preds = %for.inc25, %for.end
44 %indvar3 = phi i64 [ %indvar.next4, %for.inc25 ], [ 0, %for.end ]
45 %arrayidx22 = getelementptr [16 x i32]* @a, i64 0, i64 %indvar3
46 %arrayidx18 = getelementptr %struct.test1* %tmp1, i64 0, i32 0, i32 0, i32 0, i64 %indvar3
47 %i.1 = trunc i64 %indvar3 to i32
48 %cmp11 = icmp slt i32 %i.1, 16
49 br i1 %cmp11, label %for.body12, label %for.end28
51 for.body12: ; preds = %for.cond9
52 %tmp19 = load i32* %arrayidx18, align 4
53 %tmp23 = load i32* %arrayidx22, align 4
54 %cmp24 = icmp eq i32 %tmp19, %tmp23
55 br i1 %cmp24, label %if.end, label %if.then
57 if.then: ; preds = %for.body12
58 call void @abort() noreturn nounwind
61 if.end: ; preds = %for.body12
64 for.inc25: ; preds = %if.end
65 %indvar.next4 = add i64 %indvar3, 1
68 for.end28: ; preds = %for.cond9
71 for.cond29: ; preds = %for.inc43, %for.end28
72 %indvar1 = phi i64 [ %indvar.next2, %for.inc43 ], [ 0, %for.end28 ]
73 %arrayidx35 = getelementptr [16 x i32]* @a, i64 0, i64 %indvar1
74 %exitcond = icmp ne i64 %indvar1, 16
75 br i1 %exitcond, label %for.body32, label %for.end46
77 for.body32: ; preds = %for.cond29
78 %tmp36 = load i32* %arrayidx35, align 4
79 %ptr_t39 = getelementptr inbounds %struct.test1* %tmp1, i64 0, i32 1
80 %tmp40 = load %struct.t** %ptr_t39, align 8
81 %arrayidx42 = getelementptr %struct.t* %tmp40, i64 0, i32 0, i32 1, i64 %indvar1
82 store i32 %tmp36, i32* %arrayidx42, align 4
85 for.inc43: ; preds = %for.body32
86 %indvar.next2 = add i64 %indvar1, 1
89 for.end46: ; preds = %for.cond29
92 for.cond47: ; preds = %for.inc66, %for.end46
93 %indvar = phi i64 [ %indvar.next, %for.inc66 ], [ 0, %for.end46 ]
94 %arrayidx61 = getelementptr [16 x i32]* @a, i64 0, i64 %indvar
95 %i.3 = trunc i64 %indvar to i32
96 %cmp49 = icmp slt i32 %i.3, 16
97 br i1 %cmp49, label %for.body50, label %for.end69
99 for.body50: ; preds = %for.cond47
100 %ptr_t53 = getelementptr inbounds %struct.test1* %tmp1, i64 0, i32 1
101 %tmp54 = load %struct.t** %ptr_t53, align 8
102 %arrayidx57 = getelementptr %struct.t* %tmp54, i64 0, i32 0, i32 1, i64 %indvar
103 %tmp58 = load i32* %arrayidx57, align 4
104 %tmp62 = load i32* %arrayidx61, align 4
105 %cmp63 = icmp eq i32 %tmp58, %tmp62
106 br i1 %cmp63, label %if.end65, label %if.then64
108 if.then64: ; preds = %for.body50
109 call void @abort() noreturn nounwind
112 if.end65: ; preds = %for.body50
115 for.inc66: ; preds = %if.end65
116 %indvar.next = add i64 %indvar, 1
119 for.end69: ; preds = %for.cond47
123 declare void @abort() noreturn
125 define i32 @main() nounwind uwtable {
127 call void @check_vect()
128 %call = call i32 @main1()
132 define internal void @check_vect() nounwind uwtable noinline {
134 %a = alloca i32, align 4
135 %b = alloca i32, align 4
136 %c = alloca i32, align 4
137 %d = alloca i32, align 4
138 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
139 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
140 %tobool = icmp eq i32 %call1, 0
141 br i1 %tobool, label %if.then, label %lor.lhs.false
143 lor.lhs.false: ; preds = %entry
144 %tmp4 = load i32* %d, align 4
145 %and6 = and i32 %tmp4, 67108864
146 %cmp = icmp eq i32 %and6, 0
147 br i1 %cmp, label %if.then, label %if.end
149 if.then: ; preds = %entry, %lor.lhs.false
150 call void @exit(i32 0) noreturn nounwind
153 if.end: ; preds = %lor.lhs.false
154 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
158 declare void (i32)* @signal(i32, void (i32)*) nounwind
160 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
162 call void @exit(i32 0) noreturn nounwind
165 return: ; No predecessors!
169 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
171 %and = and i32 %__level, -2147483648
172 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
173 %cmp = icmp ult i32 %call, %__level
174 br i1 %cmp, label %if.then, label %if.end
176 if.then: ; preds = %entry
179 if.end: ; preds = %entry
180 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
181 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
182 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
183 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
184 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
185 store i32 %asmresult, i32* %__eax, align 4
186 store i32 %asmresult8, i32* %__ebx, align 4
187 store i32 %asmresult9, i32* %__ecx, align 4
188 store i32 %asmresult10, i32* %__edx, align 4
191 return: ; preds = %if.end, %if.then
192 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
196 declare void @exit(i32) noreturn
198 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
200 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
201 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
202 %tobool = icmp eq i32* %__sig, null
203 br i1 %tobool, label %if.end, label %if.then
205 if.then: ; preds = %entry
206 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
207 store i32 %asmresult1, i32* %__sig, align 4
210 if.end: ; preds = %entry, %if.then
214 !0 = metadata !{i32 -2147343165, i32 -2147343157}
215 !1 = metadata !{i32 -2147343288, i32 -2147343280}