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 no-vfa-vect-37.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer no-vfa-vect-37.s > no-vfa-vect-37.ll
6 ; ModuleID = 'no-vfa-vect-37.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 %struct.anon = type { i8*, i8* }
12 @cb = global [16 x i8] c"\00\03\06\09\0C\0F\12\15\18\1B\1E!$'*-", align 16
13 @x = common global [16 x i8] zeroinitializer, align 16
15 define i32 @main1(i8* %y) nounwind uwtable noinline {
17 %s = alloca %struct.anon, align 8
18 %p = getelementptr inbounds %struct.anon* %s, i64 0, i32 0
19 store i8* %y, i8** %p, align 8
22 for.cond: ; preds = %for.inc, %entry
23 %indvar5 = phi i64 [ %indvar.next6, %for.inc ], [ 0, %entry ]
24 %arrayidx = getelementptr [16 x i8]* @cb, i64 0, i64 %indvar5
25 %exitcond7 = icmp ne i64 %indvar5, 16
26 br i1 %exitcond7, label %for.body, label %for.end
28 for.body: ; preds = %for.cond
29 %tmp3 = load i8* %arrayidx, align 1
30 %p6 = getelementptr inbounds %struct.anon* %s, i64 0, i32 0
31 %tmp7 = load i8** %p6, align 8
32 %arrayidx8 = getelementptr i8* %tmp7, i64 %indvar5
33 store i8 %tmp3, i8* %arrayidx8, align 1
36 for.inc: ; preds = %for.body
37 %indvar.next6 = add i64 %indvar5, 1
40 for.end: ; preds = %for.cond
43 for.cond10: ; preds = %for.inc27, %for.end
44 %indvar3 = phi i64 [ %indvar.next4, %for.inc27 ], [ 0, %for.end ]
45 %arrayidx22 = getelementptr [16 x i8]* @cb, i64 0, i64 %indvar3
46 %i.1 = trunc i64 %indvar3 to i32
47 %cmp12 = icmp slt i32 %i.1, 16
48 br i1 %cmp12, label %for.body13, label %for.end30
50 for.body13: ; preds = %for.cond10
51 %p16 = getelementptr inbounds %struct.anon* %s, i64 0, i32 0
52 %tmp17 = load i8** %p16, align 8
53 %arrayidx18 = getelementptr i8* %tmp17, i64 %indvar3
54 %tmp19 = load i8* %arrayidx18, align 1
55 %tmp23 = load i8* %arrayidx22, align 1
56 %cmp25 = icmp eq i8 %tmp19, %tmp23
57 br i1 %cmp25, label %if.end, label %if.then
59 if.then: ; preds = %for.body13
60 call void @abort() noreturn nounwind
63 if.end: ; preds = %for.body13
66 for.inc27: ; preds = %if.end
67 %indvar.next4 = add i64 %indvar3, 1
70 for.end30: ; preds = %for.cond10
71 %q = getelementptr inbounds %struct.anon* %s, i64 0, i32 1
72 store i8* getelementptr inbounds ([16 x i8]* @cb, i64 0, i64 0), i8** %q, align 8
75 for.cond31: ; preds = %for.inc47, %for.end30
76 %indvar1 = phi i64 [ %indvar.next2, %for.inc47 ], [ 0, %for.end30 ]
77 %exitcond = icmp ne i64 %indvar1, 16
78 br i1 %exitcond, label %for.body35, label %for.end50
80 for.body35: ; preds = %for.cond31
81 %q38 = getelementptr inbounds %struct.anon* %s, i64 0, i32 1
82 %tmp39 = load i8** %q38, align 8
83 %arrayidx40 = getelementptr i8* %tmp39, i64 %indvar1
84 %tmp41 = load i8* %arrayidx40, align 1
85 %p44 = getelementptr inbounds %struct.anon* %s, i64 0, i32 0
86 %tmp45 = load i8** %p44, align 8
87 %arrayidx46 = getelementptr i8* %tmp45, i64 %indvar1
88 store i8 %tmp41, i8* %arrayidx46, align 1
91 for.inc47: ; preds = %for.body35
92 %indvar.next2 = add i64 %indvar1, 1
95 for.end50: ; preds = %for.cond31
98 for.cond51: ; preds = %for.inc74, %for.end50
99 %indvar = phi i64 [ %indvar.next, %for.inc74 ], [ 0, %for.end50 ]
100 %i.3 = trunc i64 %indvar to i32
101 %cmp53 = icmp slt i32 %i.3, 16
102 br i1 %cmp53, label %for.body55, label %for.end77
104 for.body55: ; preds = %for.cond51
105 %p58 = getelementptr inbounds %struct.anon* %s, i64 0, i32 0
106 %tmp59 = load i8** %p58, align 8
107 %arrayidx60 = getelementptr i8* %tmp59, i64 %indvar
108 %tmp61 = load i8* %arrayidx60, align 1
109 %q65 = getelementptr inbounds %struct.anon* %s, i64 0, i32 1
110 %tmp66 = load i8** %q65, align 8
111 %arrayidx67 = getelementptr i8* %tmp66, i64 %indvar
112 %tmp68 = load i8* %arrayidx67, align 1
113 %cmp70 = icmp eq i8 %tmp61, %tmp68
114 br i1 %cmp70, label %if.end73, label %if.then72
116 if.then72: ; preds = %for.body55
117 call void @abort() noreturn nounwind
120 if.end73: ; preds = %for.body55
123 for.inc74: ; preds = %if.end73
124 %indvar.next = add i64 %indvar, 1
127 for.end77: ; preds = %for.cond51
131 declare void @abort() noreturn
133 define i32 @main() nounwind uwtable {
135 call void @check_vect()
136 %call = call i32 @main1(i8* getelementptr inbounds ([16 x i8]* @x, i64 0, i64 0))
140 define internal void @check_vect() nounwind uwtable noinline {
142 %a = alloca i32, align 4
143 %b = alloca i32, align 4
144 %c = alloca i32, align 4
145 %d = alloca i32, align 4
146 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
147 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
148 %tobool = icmp eq i32 %call1, 0
149 br i1 %tobool, label %if.then, label %lor.lhs.false
151 lor.lhs.false: ; preds = %entry
152 %tmp4 = load i32* %d, align 4
153 %and6 = and i32 %tmp4, 67108864
154 %cmp = icmp eq i32 %and6, 0
155 br i1 %cmp, label %if.then, label %if.end
157 if.then: ; preds = %entry, %lor.lhs.false
158 call void @exit(i32 0) noreturn nounwind
161 if.end: ; preds = %lor.lhs.false
162 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
166 declare void (i32)* @signal(i32, void (i32)*) nounwind
168 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
170 call void @exit(i32 0) noreturn nounwind
173 return: ; No predecessors!
177 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
179 %and = and i32 %__level, -2147483648
180 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
181 %cmp = icmp ult i32 %call, %__level
182 br i1 %cmp, label %if.then, label %if.end
184 if.then: ; preds = %entry
187 if.end: ; preds = %entry
188 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
189 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
190 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
191 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
192 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
193 store i32 %asmresult, i32* %__eax, align 4
194 store i32 %asmresult8, i32* %__ebx, align 4
195 store i32 %asmresult9, i32* %__ecx, align 4
196 store i32 %asmresult10, i32* %__edx, align 4
199 return: ; preds = %if.end, %if.then
200 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
204 declare void @exit(i32) noreturn
206 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
208 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
209 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
210 %tobool = icmp eq i32* %__sig, null
211 br i1 %tobool, label %if.end, label %if.then
213 if.then: ; preds = %entry
214 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
215 store i32 %asmresult1, i32* %__sig, align 4
218 if.end: ; preds = %entry, %if.then
222 !0 = metadata !{i32 -2147342931, i32 -2147342923}
223 !1 = metadata !{i32 -2147343054, i32 -2147343046}