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-72.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-72.s > vect-72.ll
6 ; ModuleID = 'vect-72.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 [129 x i8] zeroinitializer, align 16
11 @ia = common global [128 x i8] zeroinitializer, align 16
13 define i32 @main1() nounwind uwtable noinline {
17 for.cond: ; preds = %for.inc, %entry
18 %indvar6 = phi i64 [ %indvar.next7, %for.inc ], [ 0, %entry ]
19 %arrayidx = getelementptr [129 x i8]* @ib, i64 0, i64 %indvar6
20 %i.0 = trunc i64 %indvar6 to i32
21 %conv = trunc i64 %indvar6 to i8
22 %exitcond8 = icmp ne i64 %indvar6, 129
23 br i1 %exitcond8, label %for.body, label %for.end
25 for.body: ; preds = %for.cond
26 store i8 %conv, i8* %arrayidx, align 1
27 %rem = srem i32 %i.0, 3
28 %cmp4 = icmp eq i32 %rem, 0
29 br i1 %cmp4, label %if.then, label %if.end
31 if.then: ; preds = %for.body
32 store i8 5, i8* %arrayidx, align 1
35 if.end: ; preds = %if.then, %for.body
38 for.inc: ; preds = %if.end
39 %indvar.next7 = add i64 %indvar6, 1
42 for.end: ; preds = %for.cond
45 for.cond10: ; preds = %for.inc22, %for.end
46 %indvar2 = phi i64 [ %indvar.next3, %for.inc22 ], [ 0, %for.end ]
47 %arrayidx21 = getelementptr [128 x i8]* @ia, i64 0, i64 %indvar2
48 %tmp4 = add i64 %indvar2, 1
49 %arrayidx17 = getelementptr [129 x i8]* @ib, i64 0, i64 %tmp4
50 %exitcond = icmp ne i64 %indvar2, 128
51 br i1 %exitcond, label %for.body14, label %for.end25
53 for.body14: ; preds = %for.cond10
54 %tmp18 = load i8* %arrayidx17, align 1
55 store i8 %tmp18, i8* %arrayidx21, align 1
58 for.inc22: ; preds = %for.body14
59 %indvar.next3 = add i64 %indvar2, 1
62 for.end25: ; preds = %for.cond10
65 for.cond26: ; preds = %for.inc46, %for.end25
66 %indvar = phi i64 [ %indvar.next, %for.inc46 ], [ 0, %for.end25 ]
67 %arrayidx34 = getelementptr [128 x i8]* @ia, i64 0, i64 %indvar
68 %tmp = add i64 %indvar, 1
69 %i.2 = trunc i64 %tmp to i32
70 %arrayidx39 = getelementptr [129 x i8]* @ib, i64 0, i64 %tmp
71 %cmp28 = icmp slt i32 %i.2, 129
72 br i1 %cmp28, label %for.body30, label %for.end49
74 for.body30: ; preds = %for.cond26
75 %tmp35 = load i8* %arrayidx34, align 1
76 %tmp40 = load i8* %arrayidx39, align 1
77 %cmp42 = icmp eq i8 %tmp35, %tmp40
78 br i1 %cmp42, label %if.end45, label %if.then44
80 if.then44: ; preds = %for.body30
81 call void @abort() noreturn nounwind
84 if.end45: ; preds = %for.body30
87 for.inc46: ; preds = %if.end45
88 %indvar.next = add i64 %indvar, 1
91 for.end49: ; preds = %for.cond26
95 declare void @abort() noreturn
97 define i32 @main() nounwind uwtable {
99 call void @check_vect()
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 !0
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 !1
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 -2147343380, i32 -2147343372}
187 !1 = metadata !{i32 -2147343503, i32 -2147343495}