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-outer-2.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-outer-2.s > vect-outer-2.ll
6 ; ModuleID = 'vect-outer-2.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 @image = common global [40 x [40 x float]] zeroinitializer, align 16
11 @out = common global [40 x float] zeroinitializer, align 16
13 define void @foo() nounwind uwtable noinline {
17 for.cond: ; preds = %for.inc12, %entry
18 %indvar1 = phi i64 [ %indvar.next2, %for.inc12 ], [ 0, %entry ]
19 %exitcond5 = icmp ne i64 %indvar1, 40
20 br i1 %exitcond5, label %for.body, label %for.end15
22 for.body: ; preds = %for.cond
25 for.cond1: ; preds = %for.inc, %for.body
26 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %for.body ]
27 %tmp6 = add i64 %indvar1, %indvar
28 %add = trunc i64 %tmp6 to i32
29 %arrayidx10 = getelementptr [40 x [40 x float]]* @image, i64 0, i64 %indvar, i64 %indvar1
30 %exitcond = icmp ne i64 %indvar, 40
31 br i1 %exitcond, label %for.body4, label %for.end
33 for.body4: ; preds = %for.cond1
34 %conv = sitofp i32 %add to float
35 store float %conv, float* %arrayidx10, align 4
38 for.inc: ; preds = %for.body4
39 %indvar.next = add i64 %indvar, 1
42 for.end: ; preds = %for.cond1
45 for.inc12: ; preds = %for.end
46 %indvar.next2 = add i64 %indvar1, 1
49 for.end15: ; preds = %for.cond
53 define i32 @main() nounwind uwtable {
55 call void @check_vect()
59 for.cond: ; preds = %for.inc15, %entry
60 %indvar1 = phi i64 [ %indvar.next2, %for.inc15 ], [ 0, %entry ]
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.end18
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 [40 x [40 x float]]* @image, i64 0, i64 %indvar, i64 %indvar1
71 %tmp5 = add i64 %indvar1, %indvar
72 %add = trunc i64 %tmp5 to i32
73 %j.0 = trunc i64 %indvar to i32
74 %cmp3 = icmp slt i32 %j.0, 40
75 br i1 %cmp3, label %for.body4, label %for.end
77 for.body4: ; preds = %for.cond1
78 %tmp9 = load float* %arrayidx8, align 4
79 %conv = sitofp i32 %add to float
80 %cmp12 = fcmp une float %tmp9, %conv
81 br i1 %cmp12, label %if.then, label %if.end
83 if.then: ; preds = %for.body4
84 call void @abort() noreturn nounwind
87 if.end: ; preds = %for.body4
90 for.inc: ; preds = %if.end
91 %indvar.next = add i64 %indvar, 1
94 for.end: ; preds = %for.cond1
97 for.inc15: ; preds = %for.end
98 %indvar.next2 = add i64 %indvar1, 1
101 for.end18: ; preds = %for.cond
105 define internal void @check_vect() nounwind uwtable noinline {
107 %a = alloca i32, align 4
108 %b = alloca i32, align 4
109 %c = alloca i32, align 4
110 %d = alloca i32, align 4
111 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
112 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
113 %tobool = icmp eq i32 %call1, 0
114 br i1 %tobool, label %if.then, label %lor.lhs.false
116 lor.lhs.false: ; preds = %entry
117 %tmp4 = load i32* %d, align 4
118 %and6 = and i32 %tmp4, 67108864
119 %cmp = icmp eq i32 %and6, 0
120 br i1 %cmp, label %if.then, label %if.end
122 if.then: ; preds = %entry, %lor.lhs.false
123 call void @exit(i32 0) noreturn nounwind
126 if.end: ; preds = %lor.lhs.false
127 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
131 declare void @abort() noreturn
133 declare void (i32)* @signal(i32, void (i32)*) nounwind
135 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
137 call void @exit(i32 0) noreturn nounwind
140 return: ; No predecessors!
144 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
146 %and = and i32 %__level, -2147483648
147 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
148 %cmp = icmp ult i32 %call, %__level
149 br i1 %cmp, label %if.then, label %if.end
151 if.then: ; preds = %entry
154 if.end: ; preds = %entry
155 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
156 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
157 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
158 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
159 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
160 store i32 %asmresult, i32* %__eax, align 4
161 store i32 %asmresult8, i32* %__ebx, align 4
162 store i32 %asmresult9, i32* %__ecx, align 4
163 store i32 %asmresult10, i32* %__edx, align 4
166 return: ; preds = %if.end, %if.then
167 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
171 declare void @exit(i32) noreturn
173 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
175 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
176 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
177 %tobool = icmp eq i32* %__sig, null
178 br i1 %tobool, label %if.end, label %if.then
180 if.then: ; preds = %entry
181 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
182 store i32 %asmresult1, i32* %__sig, align 4
185 if.end: ; preds = %entry, %if.then
189 !0 = metadata !{i32 -2147343582, i32 -2147343574}
190 !1 = metadata !{i32 -2147343705, i32 -2147343697}