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-multitypes-13.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-multitypes-13.s > vect-multitypes-13.ll
6 ; ModuleID = 'vect-multitypes-13.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 @uX = common global [64 x i8] zeroinitializer, align 16
11 @uresult = common global [64 x i32] zeroinitializer, align 16
12 @X = common global [64 x i8] zeroinitializer, align 16
13 @result = common global [64 x i32] zeroinitializer, align 16
15 define i32 @foo1(i32 %len) nounwind uwtable noinline {
17 %tmp = icmp sgt i32 %len, 0
18 %smax = select i1 %tmp, i32 %len, i32 0
19 %tmp1 = zext i32 %smax to i64
22 for.cond: ; preds = %for.inc, %entry
23 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
24 %arrayidx6 = getelementptr [64 x i32]* @uresult, i64 0, i64 %indvar
25 %arrayidx = getelementptr [64 x i8]* @uX, i64 0, i64 %indvar
26 %exitcond = icmp ne i64 %indvar, %tmp1
27 br i1 %exitcond, label %for.body, label %for.end
29 for.body: ; preds = %for.cond
30 %tmp3 = load i8* %arrayidx, align 1
31 %conv = zext i8 %tmp3 to i32
32 store i32 %conv, i32* %arrayidx6, align 4
35 for.inc: ; preds = %for.body
36 %indvar.next = add i64 %indvar, 1
39 for.end: ; preds = %for.cond
43 define i32 @foo2(i32 %len) nounwind uwtable noinline {
45 %tmp = icmp sgt i32 %len, 0
46 %smax = select i1 %tmp, i32 %len, i32 0
47 %tmp1 = zext i32 %smax to i64
50 for.cond: ; preds = %for.inc, %entry
51 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
52 %arrayidx6 = getelementptr [64 x i32]* @result, i64 0, i64 %indvar
53 %arrayidx = getelementptr [64 x i8]* @X, i64 0, i64 %indvar
54 %exitcond = icmp ne i64 %indvar, %tmp1
55 br i1 %exitcond, label %for.body, label %for.end
57 for.body: ; preds = %for.cond
58 %tmp3 = load i8* %arrayidx, align 1
59 %conv = sext i8 %tmp3 to i32
60 store i32 %conv, i32* %arrayidx6, align 4
63 for.inc: ; preds = %for.body
64 %indvar.next = add i64 %indvar, 1
67 for.end: ; preds = %for.cond
71 define i32 @main() nounwind uwtable {
73 call void @check_vect()
76 for.cond: ; preds = %for.inc, %entry
77 %indvar3 = phi i64 [ %indvar.next4, %for.inc ], [ 0, %entry ]
78 %arrayidx8 = getelementptr [64 x i8]* @uX, i64 0, i64 %indvar3
79 %tmp = mul i64 %indvar3, -1
80 %tmp5 = add i64 %tmp, 16
81 %conv = trunc i64 %tmp5 to i8
82 %arrayidx = getelementptr [64 x i8]* @X, i64 0, i64 %indvar3
83 %exitcond = icmp ne i64 %indvar3, 64
84 br i1 %exitcond, label %for.body, label %for.end
86 for.body: ; preds = %for.cond
87 store i8 %conv, i8* %arrayidx, align 1
88 store i8 %conv, i8* %arrayidx8, align 1
89 call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"() nounwind, !srcloc !0
92 for.inc: ; preds = %for.body
93 %indvar.next4 = add i64 %indvar3, 1
96 for.end: ; preds = %for.cond
97 %call = call i32 @foo1(i32 64)
100 for.cond10: ; preds = %for.inc26, %for.end
101 %indvar1 = phi i64 [ %indvar.next2, %for.inc26 ], [ 0, %for.end ]
102 %arrayidx21 = getelementptr [64 x i8]* @uX, i64 0, i64 %indvar1
103 %arrayidx17 = getelementptr [64 x i32]* @uresult, i64 0, i64 %indvar1
104 %i.1 = trunc i64 %indvar1 to i32
105 %cmp12 = icmp slt i32 %i.1, 64
106 br i1 %cmp12, label %for.body14, label %for.end29
108 for.body14: ; preds = %for.cond10
109 %tmp18 = load i32* %arrayidx17, align 4
110 %tmp22 = load i8* %arrayidx21, align 1
111 %conv23 = zext i8 %tmp22 to i32
112 %cmp24 = icmp eq i32 %tmp18, %conv23
113 br i1 %cmp24, label %if.end, label %if.then
115 if.then: ; preds = %for.body14
116 call void @abort() noreturn nounwind
119 if.end: ; preds = %for.body14
122 for.inc26: ; preds = %if.end
123 %indvar.next2 = add i64 %indvar1, 1
126 for.end29: ; preds = %for.cond10
127 %call30 = call i32 @foo2(i32 64)
130 for.cond31: ; preds = %for.inc49, %for.end29
131 %indvar = phi i64 [ %indvar.next, %for.inc49 ], [ 0, %for.end29 ]
132 %arrayidx42 = getelementptr [64 x i8]* @X, i64 0, i64 %indvar
133 %arrayidx38 = getelementptr [64 x i32]* @result, i64 0, i64 %indvar
134 %i.2 = trunc i64 %indvar to i32
135 %cmp33 = icmp slt i32 %i.2, 64
136 br i1 %cmp33, label %for.body35, label %for.end52
138 for.body35: ; preds = %for.cond31
139 %tmp39 = load i32* %arrayidx38, align 4
140 %tmp43 = load i8* %arrayidx42, align 1
141 %conv44 = sext i8 %tmp43 to i32
142 %cmp45 = icmp eq i32 %tmp39, %conv44
143 br i1 %cmp45, label %if.end48, label %if.then47
145 if.then47: ; preds = %for.body35
146 call void @abort() noreturn nounwind
149 if.end48: ; preds = %for.body35
152 for.inc49: ; preds = %if.end48
153 %indvar.next = add i64 %indvar, 1
156 for.end52: ; preds = %for.cond31
160 define internal void @check_vect() nounwind uwtable noinline {
162 %a = alloca i32, align 4
163 %b = alloca i32, align 4
164 %c = alloca i32, align 4
165 %d = alloca i32, align 4
166 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
167 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
168 %tobool = icmp eq i32 %call1, 0
169 br i1 %tobool, label %if.then, label %lor.lhs.false
171 lor.lhs.false: ; preds = %entry
172 %tmp4 = load i32* %d, align 4
173 %and6 = and i32 %tmp4, 67108864
174 %cmp = icmp eq i32 %and6, 0
175 br i1 %cmp, label %if.then, label %if.end
177 if.then: ; preds = %entry, %lor.lhs.false
178 call void @exit(i32 0) noreturn nounwind
181 if.end: ; preds = %lor.lhs.false
182 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
186 declare void @abort() noreturn
188 declare void (i32)* @signal(i32, void (i32)*) nounwind
190 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
192 call void @exit(i32 0) noreturn nounwind
195 return: ; No predecessors!
199 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
201 %and = and i32 %__level, -2147483648
202 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
203 %cmp = icmp ult i32 %call, %__level
204 br i1 %cmp, label %if.then, label %if.end
206 if.then: ; preds = %entry
209 if.end: ; preds = %entry
210 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !1
211 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
212 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
213 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
214 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
215 store i32 %asmresult, i32* %__eax, align 4
216 store i32 %asmresult8, i32* %__ebx, align 4
217 store i32 %asmresult9, i32* %__ecx, align 4
218 store i32 %asmresult10, i32* %__edx, align 4
221 return: ; preds = %if.end, %if.then
222 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
226 declare void @exit(i32) noreturn
228 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
230 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !2
231 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
232 %tobool = icmp eq i32* %__sig, null
233 br i1 %tobool, label %if.end, label %if.then
235 if.then: ; preds = %entry
236 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
237 store i32 %asmresult1, i32* %__sig, align 4
240 if.end: ; preds = %entry, %if.then
244 !0 = metadata !{i32 742}
245 !1 = metadata !{i32 -2147343214, i32 -2147343206}
246 !2 = metadata !{i32 -2147343337, i32 -2147343329}