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-vfa-vect-depend-1.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer no-vfa-vect-depend-1.s > no-vfa-vect-depend-1.ll
6 ; ModuleID = 'no-vfa-vect-depend-1.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 @ia = global [17 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, i32 48], align 16
11 @ib = global [17 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, i32 48], align 16
12 @res = global [17 x i32] [i32 12, i32 24, i32 36, i32 48, i32 60, i32 72, i32 84, i32 96, i32 108, i32 120, i32 132, i32 144, i32 156, i32 168, i32 180, i32 192, i32 48], align 16
14 define i32 @main1() nounwind uwtable noinline {
18 for.cond: ; preds = %for.inc, %entry
19 %indvar7 = phi i64 [ %indvar.next8, %for.inc ], [ 0, %entry ]
20 %tmp10 = add i64 %indvar7, 1
21 %arrayidx5 = getelementptr [17 x i32]* @ia, i64 0, i64 %tmp10
22 %arrayidx = getelementptr [17 x i32]* @ia, i64 0, i64 %indvar7
23 %exitcond9 = icmp ne i64 %indvar7, 16
24 br i1 %exitcond9, label %for.body, label %for.end
26 for.body: ; preds = %for.cond
27 %tmp2 = load i32* %arrayidx, align 4
28 %mul = shl nsw i32 %tmp2, 2
29 store i32 %mul, i32* %arrayidx5, align 4
32 for.inc: ; preds = %for.body
33 %indvar.next8 = add i64 %indvar7, 1
36 for.end: ; preds = %for.cond
39 for.cond7: ; preds = %for.inc16, %for.end
40 %indvar4 = phi i64 [ %indvar.next5, %for.inc16 ], [ 0, %for.end ]
41 %arrayidx13 = getelementptr [17 x i32]* @ia, i64 0, i64 %indvar4
42 %i.1 = trunc i64 %indvar4 to i32
43 %cmp9 = icmp slt i32 %i.1, 16
44 br i1 %cmp9, label %for.body10, label %for.end19
46 for.body10: ; preds = %for.cond7
47 %tmp14 = load i32* %arrayidx13, align 4
48 %cmp15 = icmp eq i32 %tmp14, 0
49 br i1 %cmp15, label %if.end, label %if.then
51 if.then: ; preds = %for.body10
52 call void @abort() noreturn nounwind
55 if.end: ; preds = %for.body10
58 for.inc16: ; preds = %if.end
59 %indvar.next5 = add i64 %indvar4, 1
62 for.end19: ; preds = %for.cond7
65 for.cond20: ; preds = %for.inc33, %for.end19
66 %indvar1 = phi i64 [ %indvar.next2, %for.inc33 ], [ 0, %for.end19 ]
67 %arrayidx32 = getelementptr [17 x i32]* @ib, i64 0, i64 %indvar1
68 %tmp = add i64 %indvar1, 1
69 %arrayidx27 = getelementptr [17 x i32]* @ib, i64 0, i64 %tmp
70 %exitcond = icmp ne i64 %indvar1, 16
71 br i1 %exitcond, label %for.body23, label %for.end36
73 for.body23: ; preds = %for.cond20
74 %tmp28 = load i32* %arrayidx27, align 4
75 %mul29 = shl nsw i32 %tmp28, 2
76 store i32 %mul29, i32* %arrayidx32, align 4
79 for.inc33: ; preds = %for.body23
80 %indvar.next2 = add i64 %indvar1, 1
83 for.end36: ; preds = %for.cond20
86 for.cond37: ; preds = %for.inc52, %for.end36
87 %indvar = phi i64 [ %indvar.next, %for.inc52 ], [ 0, %for.end36 ]
88 %arrayidx47 = getelementptr [17 x i32]* @res, i64 0, i64 %indvar
89 %arrayidx43 = getelementptr [17 x i32]* @ib, i64 0, i64 %indvar
90 %i.3 = trunc i64 %indvar to i32
91 %cmp39 = icmp slt i32 %i.3, 16
92 br i1 %cmp39, label %for.body40, label %for.end55
94 for.body40: ; preds = %for.cond37
95 %tmp44 = load i32* %arrayidx43, align 4
96 %tmp48 = load i32* %arrayidx47, align 4
97 %cmp49 = icmp eq i32 %tmp44, %tmp48
98 br i1 %cmp49, label %if.end51, label %if.then50
100 if.then50: ; preds = %for.body40
101 call void @abort() noreturn nounwind
104 if.end51: ; preds = %for.body40
107 for.inc52: ; preds = %if.end51
108 %indvar.next = add i64 %indvar, 1
111 for.end55: ; preds = %for.cond37
115 declare void @abort() noreturn
117 define i32 @main() nounwind uwtable {
119 call void @check_vect()
120 %call = call i32 @main1()
124 define internal void @check_vect() nounwind uwtable noinline {
126 %a = alloca i32, align 4
127 %b = alloca i32, align 4
128 %c = alloca i32, align 4
129 %d = alloca i32, align 4
130 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
131 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
132 %tobool = icmp eq i32 %call1, 0
133 br i1 %tobool, label %if.then, label %lor.lhs.false
135 lor.lhs.false: ; preds = %entry
136 %tmp4 = load i32* %d, align 4
137 %and6 = and i32 %tmp4, 67108864
138 %cmp = icmp eq i32 %and6, 0
139 br i1 %cmp, label %if.then, label %if.end
141 if.then: ; preds = %entry, %lor.lhs.false
142 call void @exit(i32 0) noreturn nounwind
145 if.end: ; preds = %lor.lhs.false
146 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
150 declare void (i32)* @signal(i32, void (i32)*) nounwind
152 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
154 call void @exit(i32 0) noreturn nounwind
157 return: ; No predecessors!
161 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
163 %and = and i32 %__level, -2147483648
164 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
165 %cmp = icmp ult i32 %call, %__level
166 br i1 %cmp, label %if.then, label %if.end
168 if.then: ; preds = %entry
171 if.end: ; preds = %entry
172 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
173 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
174 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
175 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
176 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
177 store i32 %asmresult, i32* %__eax, align 4
178 store i32 %asmresult8, i32* %__ebx, align 4
179 store i32 %asmresult9, i32* %__ecx, align 4
180 store i32 %asmresult10, i32* %__edx, align 4
183 return: ; preds = %if.end, %if.then
184 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
188 declare void @exit(i32) noreturn
190 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
192 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
193 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
194 %tobool = icmp eq i32* %__sig, null
195 br i1 %tobool, label %if.end, label %if.then
197 if.then: ; preds = %entry
198 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
199 store i32 %asmresult1, i32* %__sig, align 4
202 if.end: ; preds = %entry, %if.then
206 !0 = metadata !{i32 -2147343180, i32 -2147343172}
207 !1 = metadata !{i32 -2147343303, i32 -2147343295}