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-11a.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-11a.s > vect-11a.ll
6 ; ModuleID = 'vect-11a.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 = global [8 x i32] [i32 134217728, i32 -1, i32 -16776961, i32 -268435455, i32 134217728, i32 -1, i32 -16776961, i32 -268435455], align 16
11 @B = global [8 x i32] [i32 134217728, i32 134217729, i32 -16776961, i32 -268435455, i32 134217728, i32 134217729, i32 -16776961, i32 -268435455], align 16
12 @Answer = global [8 x i32] [i32 0, i32 -134217729, i32 33619457, i32 -536870911, i32 0, i32 -134217729, i32 33619457, i32 -536870911], align 16
13 @C = common global [8 x i32] zeroinitializer, align 16
14 @D = global [8 x i32] [i32 134217728, i32 -1, i32 -16776961, i32 -268435455, i32 134217728, i32 -1, i32 -16776961, i32 -268435455], align 16
15 @E = global [8 x i32] [i32 134217728, i32 134217729, i32 -16776961, i32 -268435455, i32 134217728, i32 134217729, i32 -16776961, i32 -268435455], align 16
16 @Dnswer = global [8 x i32] [i32 0, i32 -134217729, i32 33619457, i32 -536870911, i32 0, i32 -134217729, i32 33619457, i32 -536870911], align 16
17 @F = common global [8 x i32] zeroinitializer, align 16
19 define void @u() nounwind uwtable noinline {
23 for.cond: ; preds = %for.inc, %entry
24 %indvar1 = phi i64 [ %indvar.next2, %for.inc ], [ 0, %entry ]
25 %arrayidx9 = getelementptr [8 x i32]* @C, i64 0, i64 %indvar1
26 %arrayidx5 = getelementptr [8 x i32]* @B, i64 0, i64 %indvar1
27 %arrayidx = getelementptr [8 x i32]* @A, i64 0, i64 %indvar1
28 %exitcond = icmp ne i64 %indvar1, 8
29 br i1 %exitcond, label %for.body, label %for.end
31 for.body: ; preds = %for.cond
32 %tmp2 = load i32* %arrayidx, align 4
33 %tmp6 = load i32* %arrayidx5, align 4
34 %mul = mul i32 %tmp2, %tmp6
35 store i32 %mul, i32* %arrayidx9, align 4
38 for.inc: ; preds = %for.body
39 %indvar.next2 = add i64 %indvar1, 1
42 for.end: ; preds = %for.cond
45 for.cond11: ; preds = %for.inc24, %for.end
46 %indvar = phi i64 [ %indvar.next, %for.inc24 ], [ 0, %for.end ]
47 %arrayidx21 = getelementptr [8 x i32]* @Answer, i64 0, i64 %indvar
48 %arrayidx17 = getelementptr [8 x i32]* @C, i64 0, i64 %indvar
49 %i.1 = trunc i64 %indvar to i32
50 %cmp13 = icmp slt i32 %i.1, 8
51 br i1 %cmp13, label %for.body14, label %for.end27
53 for.body14: ; preds = %for.cond11
54 %tmp18 = load i32* %arrayidx17, align 4
55 %tmp22 = load i32* %arrayidx21, align 4
56 %cmp23 = icmp eq i32 %tmp18, %tmp22
57 br i1 %cmp23, label %if.end, label %if.then
59 if.then: ; preds = %for.body14
60 call void @abort() noreturn nounwind
63 if.end: ; preds = %for.body14
66 for.inc24: ; preds = %if.end
67 %indvar.next = add i64 %indvar, 1
70 for.end27: ; preds = %for.cond11
74 declare void @abort() noreturn
76 define void @s() nounwind uwtable noinline {
80 for.cond: ; preds = %for.inc, %entry
81 %indvar1 = phi i64 [ %indvar.next2, %for.inc ], [ 0, %entry ]
82 %arrayidx9 = getelementptr [8 x i32]* @F, i64 0, i64 %indvar1
83 %arrayidx5 = getelementptr [8 x i32]* @E, i64 0, i64 %indvar1
84 %arrayidx = getelementptr [8 x i32]* @D, i64 0, i64 %indvar1
85 %exitcond = icmp ne i64 %indvar1, 8
86 br i1 %exitcond, label %for.body, label %for.end
88 for.body: ; preds = %for.cond
89 %tmp2 = load i32* %arrayidx, align 4
90 %tmp6 = load i32* %arrayidx5, align 4
91 %mul = mul nsw i32 %tmp2, %tmp6
92 store i32 %mul, i32* %arrayidx9, align 4
95 for.inc: ; preds = %for.body
96 %indvar.next2 = add i64 %indvar1, 1
99 for.end: ; preds = %for.cond
102 for.cond11: ; preds = %for.inc24, %for.end
103 %indvar = phi i64 [ %indvar.next, %for.inc24 ], [ 0, %for.end ]
104 %arrayidx21 = getelementptr [8 x i32]* @Dnswer, i64 0, i64 %indvar
105 %arrayidx17 = getelementptr [8 x i32]* @F, i64 0, i64 %indvar
106 %i.1 = trunc i64 %indvar to i32
107 %cmp13 = icmp slt i32 %i.1, 8
108 br i1 %cmp13, label %for.body14, label %for.end27
110 for.body14: ; preds = %for.cond11
111 %tmp18 = load i32* %arrayidx17, align 4
112 %tmp22 = load i32* %arrayidx21, align 4
113 %cmp23 = icmp eq i32 %tmp18, %tmp22
114 br i1 %cmp23, label %if.end, label %if.then
116 if.then: ; preds = %for.body14
117 call void @abort() noreturn nounwind
120 if.end: ; preds = %for.body14
123 for.inc24: ; preds = %if.end
124 %indvar.next = add i64 %indvar, 1
127 for.end27: ; preds = %for.cond11
131 define i32 @main1() nounwind uwtable noinline {
138 define i32 @main() nounwind uwtable {
140 call void @check_vect()
141 %call = call i32 @main1()
145 define internal void @check_vect() nounwind uwtable noinline {
147 %a = alloca i32, align 4
148 %b = alloca i32, align 4
149 %c = alloca i32, align 4
150 %d = alloca i32, align 4
151 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
152 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
153 %tobool = icmp eq i32 %call1, 0
154 br i1 %tobool, label %if.then, label %lor.lhs.false
156 lor.lhs.false: ; preds = %entry
157 %tmp4 = load i32* %d, align 4
158 %and6 = and i32 %tmp4, 67108864
159 %cmp = icmp eq i32 %and6, 0
160 br i1 %cmp, label %if.then, label %if.end
162 if.then: ; preds = %entry, %lor.lhs.false
163 call void @exit(i32 0) noreturn nounwind
166 if.end: ; preds = %lor.lhs.false
167 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
171 declare void (i32)* @signal(i32, void (i32)*) nounwind
173 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
175 call void @exit(i32 0) noreturn nounwind
178 return: ; No predecessors!
182 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
184 %and = and i32 %__level, -2147483648
185 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
186 %cmp = icmp ult i32 %call, %__level
187 br i1 %cmp, label %if.then, label %if.end
189 if.then: ; preds = %entry
192 if.end: ; preds = %entry
193 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
194 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
195 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
196 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
197 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
198 store i32 %asmresult, i32* %__eax, align 4
199 store i32 %asmresult8, i32* %__ebx, align 4
200 store i32 %asmresult9, i32* %__ecx, align 4
201 store i32 %asmresult10, i32* %__edx, align 4
204 return: ; preds = %if.end, %if.then
205 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
209 declare void @exit(i32) noreturn
211 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
213 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
214 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
215 %tobool = icmp eq i32* %__sig, null
216 br i1 %tobool, label %if.end, label %if.then
218 if.then: ; preds = %entry
219 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
220 store i32 %asmresult1, i32* %__sig, align 4
223 if.end: ; preds = %entry, %if.then
227 !0 = metadata !{i32 -2147342848, i32 -2147342840}
228 !1 = metadata !{i32 -2147342971, i32 -2147342963}