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-97.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-97.s > vect-97.ll
6 ; ModuleID = 'vect-97.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() nounwind uwtable noinline {
17 %s = alloca %struct.anon, align 8
18 %p = getelementptr inbounds %struct.anon* %s, i64 0, i32 0
19 store i8* getelementptr inbounds ([16 x i8]* @x, i64 0, i64 0), 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 %tmp2 = load i8* %arrayidx, align 1
30 %p5 = getelementptr inbounds %struct.anon* %s, i64 0, i32 0
31 %tmp6 = load i8** %p5, align 8
32 %arrayidx7 = getelementptr i8* %tmp6, i64 %indvar5
33 store i8 %tmp2, i8* %arrayidx7, align 1
36 for.inc: ; preds = %for.body
37 %indvar.next6 = add i64 %indvar5, 1
40 for.end: ; preds = %for.cond
43 for.cond9: ; preds = %for.inc26, %for.end
44 %indvar3 = phi i64 [ %indvar.next4, %for.inc26 ], [ 0, %for.end ]
45 %arrayidx21 = getelementptr [16 x i8]* @cb, i64 0, i64 %indvar3
46 %i.1 = trunc i64 %indvar3 to i32
47 %cmp11 = icmp slt i32 %i.1, 16
48 br i1 %cmp11, label %for.body12, label %for.end29
50 for.body12: ; preds = %for.cond9
51 %p15 = getelementptr inbounds %struct.anon* %s, i64 0, i32 0
52 %tmp16 = load i8** %p15, align 8
53 %arrayidx17 = getelementptr i8* %tmp16, i64 %indvar3
54 %tmp18 = load i8* %arrayidx17, align 1
55 %tmp22 = load i8* %arrayidx21, align 1
56 %cmp24 = icmp eq i8 %tmp18, %tmp22
57 br i1 %cmp24, label %if.end, label %if.then
59 if.then: ; preds = %for.body12
60 call void @abort() noreturn nounwind
63 if.end: ; preds = %for.body12
66 for.inc26: ; preds = %if.end
67 %indvar.next4 = add i64 %indvar3, 1
70 for.end29: ; preds = %for.cond9
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.cond30: ; preds = %for.inc46, %for.end29
76 %indvar1 = phi i64 [ %indvar.next2, %for.inc46 ], [ 0, %for.end29 ]
77 %exitcond = icmp ne i64 %indvar1, 16
78 br i1 %exitcond, label %for.body34, label %for.end49
80 for.body34: ; preds = %for.cond30
81 %q37 = getelementptr inbounds %struct.anon* %s, i64 0, i32 1
82 %tmp38 = load i8** %q37, align 8
83 %arrayidx39 = getelementptr i8* %tmp38, i64 %indvar1
84 %tmp40 = load i8* %arrayidx39, align 1
85 %p43 = getelementptr inbounds %struct.anon* %s, i64 0, i32 0
86 %tmp44 = load i8** %p43, align 8
87 %arrayidx45 = getelementptr i8* %tmp44, i64 %indvar1
88 store i8 %tmp40, i8* %arrayidx45, align 1
91 for.inc46: ; preds = %for.body34
92 %indvar.next2 = add i64 %indvar1, 1
95 for.end49: ; preds = %for.cond30
98 for.cond50: ; preds = %for.inc73, %for.end49
99 %indvar = phi i64 [ %indvar.next, %for.inc73 ], [ 0, %for.end49 ]
100 %i.3 = trunc i64 %indvar to i32
101 %cmp52 = icmp slt i32 %i.3, 16
102 br i1 %cmp52, label %for.body54, label %for.end76
104 for.body54: ; preds = %for.cond50
105 %p57 = getelementptr inbounds %struct.anon* %s, i64 0, i32 0
106 %tmp58 = load i8** %p57, align 8
107 %arrayidx59 = getelementptr i8* %tmp58, i64 %indvar
108 %tmp60 = load i8* %arrayidx59, align 1
109 %q64 = getelementptr inbounds %struct.anon* %s, i64 0, i32 1
110 %tmp65 = load i8** %q64, align 8
111 %arrayidx66 = getelementptr i8* %tmp65, i64 %indvar
112 %tmp67 = load i8* %arrayidx66, align 1
113 %cmp69 = icmp eq i8 %tmp60, %tmp67
114 br i1 %cmp69, label %if.end72, label %if.then71
116 if.then71: ; preds = %for.body54
117 call void @abort() noreturn nounwind
120 if.end72: ; preds = %for.body54
123 for.inc73: ; preds = %if.end72
124 %indvar.next = add i64 %indvar, 1
127 for.end76: ; preds = %for.cond50
131 declare void @abort() noreturn
133 define i32 @main() nounwind uwtable {
135 call void @check_vect()
136 %call = call i32 @main1()
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 -2147342877, i32 -2147342869}
223 !1 = metadata !{i32 -2147343000, i32 -2147342992}