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-peel-2.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-peel-2.s > vect-peel-2.ll
6 ; ModuleID = 'vect-peel-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 @ib = common global [135 x i32] zeroinitializer, align 16
12 define i32 @main1() nounwind uwtable noinline {
14 %ia = alloca [129 x i32], align 16
17 for.cond: ; preds = %for.inc, %entry
18 %indvar5 = phi i64 [ %indvar.next6, %for.inc ], [ 0, %entry ]
19 %arrayidx11 = getelementptr [129 x i32]* %ia, i64 0, i64 %indvar5
20 %tmp9 = add i64 %indvar5, 6
21 %arrayidx6 = getelementptr [135 x i32]* @ib, i64 0, i64 %tmp9
22 %tmp10 = add i64 %indvar5, 2
23 %arrayidx = getelementptr [135 x i32]* @ib, i64 0, i64 %tmp10
24 %exitcond = icmp ne i64 %indvar5, 129
25 br i1 %exitcond, label %for.body, label %for.end
27 for.body: ; preds = %for.cond
28 %tmp2 = load i32* %arrayidx, align 4
29 %tmp7 = load i32* %arrayidx6, align 4
30 %add8 = add nsw i32 %tmp2, %tmp7
31 store i32 %add8, i32* %arrayidx11, align 4
34 for.inc: ; preds = %for.body
35 %indvar.next6 = add i64 %indvar5, 1
38 for.end: ; preds = %for.cond
41 for.cond13: ; preds = %for.inc33, %for.end
42 %indvar = phi i64 [ %indvar.next, %for.inc33 ], [ 0, %for.end ]
43 %tmp = add i64 %indvar, 1
44 %i.1 = trunc i64 %tmp to i32
45 %tmp3 = add i64 %indvar, 7
46 %arrayidx29 = getelementptr [135 x i32]* @ib, i64 0, i64 %tmp3
47 %tmp4 = add i64 %indvar, 3
48 %arrayidx24 = getelementptr [135 x i32]* @ib, i64 0, i64 %tmp4
49 %arrayidx19 = getelementptr [129 x i32]* %ia, i64 0, i64 %tmp
50 %cmp15 = icmp slt i32 %i.1, 129
51 br i1 %cmp15, label %for.body16, label %for.end36
53 for.body16: ; preds = %for.cond13
54 %tmp20 = load i32* %arrayidx19, align 4
55 %tmp25 = load i32* %arrayidx24, align 4
56 %tmp30 = load i32* %arrayidx29, align 4
57 %add31 = add nsw i32 %tmp25, %tmp30
58 %cmp32 = icmp eq i32 %tmp20, %add31
59 br i1 %cmp32, label %if.end, label %if.then
61 if.then: ; preds = %for.body16
62 call void @abort() noreturn nounwind
65 if.end: ; preds = %for.body16
68 for.inc33: ; preds = %if.end
69 %indvar.next = add i64 %indvar, 1
72 for.end36: ; preds = %for.cond13
76 declare void @abort() noreturn
78 define i32 @main() nounwind uwtable {
80 call void @check_vect()
83 for.cond: ; preds = %for.inc, %entry
84 %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
85 %cmp = icmp slt i32 %i.0, 135
86 br i1 %cmp, label %for.body, label %for.end
88 for.body: ; preds = %for.cond
89 %tmp = call i32 asm sideeffect "", "=r,0,~{dirflag},~{fpsr},~{flags}"(i32 %i.0) nounwind, !srcloc !0
90 %idxprom = sext i32 %tmp to i64
91 %arrayidx = getelementptr inbounds [135 x i32]* @ib, i64 0, i64 %idxprom
92 store i32 %tmp, i32* %arrayidx, align 4
95 for.inc: ; preds = %for.body
96 %inc = add nsw i32 %tmp, 1
99 for.end: ; preds = %for.cond
100 %call = call i32 @main1()
104 define internal void @check_vect() nounwind uwtable noinline {
106 %a = alloca i32, align 4
107 %b = alloca i32, align 4
108 %c = alloca i32, align 4
109 %d = alloca i32, align 4
110 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
111 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
112 %tobool = icmp eq i32 %call1, 0
113 br i1 %tobool, label %if.then, label %lor.lhs.false
115 lor.lhs.false: ; preds = %entry
116 %tmp4 = load i32* %d, align 4
117 %and6 = and i32 %tmp4, 67108864
118 %cmp = icmp eq i32 %and6, 0
119 br i1 %cmp, label %if.then, label %if.end
121 if.then: ; preds = %entry, %lor.lhs.false
122 call void @exit(i32 0) noreturn nounwind
125 if.end: ; preds = %lor.lhs.false
126 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
130 declare void (i32)* @signal(i32, void (i32)*) nounwind
132 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
134 call void @exit(i32 0) noreturn nounwind
137 return: ; No predecessors!
141 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
143 %and = and i32 %__level, -2147483648
144 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
145 %cmp = icmp ult i32 %call, %__level
146 br i1 %cmp, label %if.then, label %if.end
148 if.then: ; preds = %entry
151 if.end: ; preds = %entry
152 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !1
153 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
154 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
155 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
156 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
157 store i32 %asmresult, i32* %__eax, align 4
158 store i32 %asmresult8, i32* %__ebx, align 4
159 store i32 %asmresult9, i32* %__ecx, align 4
160 store i32 %asmresult10, i32* %__edx, align 4
163 return: ; preds = %if.end, %if.then
164 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
168 declare void @exit(i32) noreturn
170 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
172 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !2
173 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
174 %tobool = icmp eq i32* %__sig, null
175 br i1 %tobool, label %if.end, label %if.then
177 if.then: ; preds = %entry
178 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
179 store i32 %asmresult1, i32* %__sig, align 4
182 if.end: ; preds = %entry, %if.then
186 !0 = metadata !{i32 767}
187 !1 = metadata !{i32 -2147343130, i32 -2147343122}
188 !2 = metadata !{i32 -2147343253, i32 -2147343245}