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-71.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-71.s > vect-71.ll
6 ; ModuleID = 'vect-71.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 @main1.ib = internal unnamed_addr constant [17 x i32] [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, i32 0, i32 1, i32 2], align 16
12 define i32 @main1() nounwind uwtable noinline {
14 %ia = alloca [16 x i32], align 16
15 %ib = alloca [17 x i32], align 16
16 %tmp = bitcast [17 x i32]* %ib to i8*
17 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %tmp, i8* bitcast ([17 x i32]* @main1.ib to i8*), i64 68, i32 16, i1 false)
20 for.cond: ; preds = %for.inc, %entry
21 %indvar3 = phi i64 [ %indvar.next4, %for.inc ], [ 0, %entry ]
22 %tmp5 = add i64 %indvar3, 2
23 %arrayidx = getelementptr [17 x i32]* %ib, i64 0, i64 %tmp5
24 %exitcond = icmp ne i64 %indvar3, 15
25 br i1 %exitcond, label %for.body, label %for.end
27 for.body: ; preds = %for.cond
28 %tmp3 = load i32* %arrayidx, align 4
29 %idxprom4 = zext i32 %tmp3 to i64
30 %arrayidx5 = getelementptr inbounds [16 x i32]* %ia, i64 0, i64 %idxprom4
31 store i32 0, i32* %arrayidx5, align 4
34 for.inc: ; preds = %for.body
35 %indvar.next4 = add i64 %indvar3, 1
38 for.end: ; preds = %for.cond
41 for.cond7: ; preds = %for.inc19, %for.end
42 %indvar = phi i64 [ %indvar.next, %for.inc19 ], [ 0, %for.end ]
43 %tmp1 = add i64 %indvar, 2
44 %arrayidx13 = getelementptr [17 x i32]* %ib, i64 0, i64 %tmp1
45 %i.1 = trunc i64 %tmp1 to i32
46 %cmp9 = icmp slt i32 %i.1, 17
47 br i1 %cmp9, label %for.body10, label %for.end22
49 for.body10: ; preds = %for.cond7
50 %tmp14 = load i32* %arrayidx13, align 4
51 %idxprom15 = zext i32 %tmp14 to i64
52 %arrayidx16 = getelementptr inbounds [16 x i32]* %ia, i64 0, i64 %idxprom15
53 %tmp17 = load i32* %arrayidx16, align 4
54 %cmp18 = icmp eq i32 %tmp17, 0
55 br i1 %cmp18, label %if.end, label %if.then
57 if.then: ; preds = %for.body10
58 call void @abort() noreturn nounwind
61 if.end: ; preds = %for.body10
64 for.inc19: ; preds = %if.end
65 %indvar.next = add i64 %indvar, 1
68 for.end22: ; preds = %for.cond7
72 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i32, i1) nounwind
74 declare void @abort() noreturn
76 define i32 @main() nounwind uwtable {
78 call void @check_vect()
79 %call = call i32 @main1()
83 define internal void @check_vect() nounwind uwtable noinline {
85 %a = alloca i32, align 4
86 %b = alloca i32, align 4
87 %c = alloca i32, align 4
88 %d = alloca i32, align 4
89 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
90 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
91 %tobool = icmp eq i32 %call1, 0
92 br i1 %tobool, label %if.then, label %lor.lhs.false
94 lor.lhs.false: ; preds = %entry
95 %tmp4 = load i32* %d, align 4
96 %and6 = and i32 %tmp4, 67108864
97 %cmp = icmp eq i32 %and6, 0
98 br i1 %cmp, label %if.then, label %if.end
100 if.then: ; preds = %entry, %lor.lhs.false
101 call void @exit(i32 0) noreturn nounwind
104 if.end: ; preds = %lor.lhs.false
105 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
109 declare void (i32)* @signal(i32, void (i32)*) nounwind
111 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
113 call void @exit(i32 0) noreturn nounwind
116 return: ; No predecessors!
120 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
122 %and = and i32 %__level, -2147483648
123 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
124 %cmp = icmp ult i32 %call, %__level
125 br i1 %cmp, label %if.then, label %if.end
127 if.then: ; preds = %entry
130 if.end: ; preds = %entry
131 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
132 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
133 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
134 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
135 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
136 store i32 %asmresult, i32* %__eax, align 4
137 store i32 %asmresult8, i32* %__ebx, align 4
138 store i32 %asmresult9, i32* %__ecx, align 4
139 store i32 %asmresult10, i32* %__edx, align 4
142 return: ; preds = %if.end, %if.then
143 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
147 declare void @exit(i32) noreturn
149 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
151 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
152 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
153 %tobool = icmp eq i32* %__sig, null
154 br i1 %tobool, label %if.end, label %if.then
156 if.then: ; preds = %entry
157 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
158 store i32 %asmresult1, i32* %__sig, align 4
161 if.end: ; preds = %entry, %if.then
165 !0 = metadata !{i32 -2147343659, i32 -2147343651}
166 !1 = metadata !{i32 -2147343782, i32 -2147343774}