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 slp-37.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer slp-37.s > slp-37.ll
6 ; ModuleID = 'slp-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.s1 = type { i32, i32, i8* }
12 define i32 @foo1(%struct.s1* %arr) nounwind uwtable {
16 for.cond: ; preds = %for.inc, %entry
17 %indvar2 = phi i64 [ %indvar.next3, %for.inc ], [ 0, %entry ]
18 %c = getelementptr %struct.s1* %arr, i64 %indvar2, i32 2
19 %b = getelementptr %struct.s1* %arr, i64 %indvar2, i32 1
20 %scevgep6 = getelementptr %struct.s1* %arr, i64 %indvar2
21 %a = bitcast %struct.s1* %scevgep6 to i32*
22 %exitcond = icmp ne i64 %indvar2, 128
23 br i1 %exitcond, label %for.body, label %for.end
25 for.body: ; preds = %for.cond
26 store i32 6, i32* %a, align 4
27 store i32 7, i32* %b, align 4
28 store i8* null, i8** %c, align 8
31 for.inc: ; preds = %for.body
32 %indvar.next3 = add i64 %indvar2, 1
35 for.end: ; preds = %for.cond
38 for.cond7: ; preds = %for.inc31, %for.end
39 %indvar = phi i64 [ %indvar.next, %for.inc31 ], [ 0, %for.end ]
40 %c28 = getelementptr %struct.s1* %arr, i64 %indvar, i32 2
41 %b20 = getelementptr %struct.s1* %arr, i64 %indvar, i32 1
42 %scevgep = getelementptr %struct.s1* %arr, i64 %indvar
43 %a13 = bitcast %struct.s1* %scevgep to i32*
44 %i.1 = trunc i64 %indvar to i32
45 %cmp9 = icmp slt i32 %i.1, 128
46 br i1 %cmp9, label %for.body10, label %for.end34
48 for.body10: ; preds = %for.cond7
49 %tmp14 = load i32* %a13, align 4
50 %cmp15 = icmp eq i32 %tmp14, 6
51 br i1 %cmp15, label %lor.lhs.false, label %if.then
53 lor.lhs.false: ; preds = %for.body10
54 %tmp21 = load i32* %b20, align 4
55 %cmp22 = icmp eq i32 %tmp21, 7
56 br i1 %cmp22, label %lor.lhs.false23, label %if.then
58 lor.lhs.false23: ; preds = %lor.lhs.false
59 %tmp29 = load i8** %c28, align 8
60 %cmp30 = icmp eq i8* %tmp29, null
61 br i1 %cmp30, label %if.end, label %if.then
63 if.then: ; preds = %lor.lhs.false23, %lor.lhs.false, %for.body10
64 call void @abort() noreturn nounwind
67 if.end: ; preds = %lor.lhs.false23
70 for.inc31: ; preds = %if.end
71 %indvar.next = add i64 %indvar, 1
74 for.end34: ; preds = %for.cond7
78 declare void @abort() noreturn nounwind
80 define i32 @main() nounwind uwtable {
82 %arr1 = alloca [128 x %struct.s1], align 16
83 call void @check_vect()
86 for.cond: ; preds = %for.inc, %entry
87 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
88 %tmp = mul i64 %indvar, 2
89 %mul = trunc i64 %tmp to i32
90 %scevgep = getelementptr [128 x %struct.s1]* %arr1, i64 0, i64 %indvar
91 %a = bitcast %struct.s1* %scevgep to i32*
92 %c = getelementptr [128 x %struct.s1]* %arr1, i64 0, i64 %indvar, i32 2
93 %b = getelementptr [128 x %struct.s1]* %arr1, i64 0, i64 %indvar, i32 1
94 %i.0 = trunc i64 %indvar to i32
95 %cmp = icmp slt i32 %i.0, 128
96 br i1 %cmp, label %for.body, label %for.end
98 for.body: ; preds = %for.cond
99 store i32 %i.0, i32* %a, align 16
100 store i32 %mul, i32* %b, align 4
101 %tmp6 = bitcast [128 x %struct.s1]* %arr1 to i8*
102 store i8* %tmp6, i8** %c, align 8
103 %tmp14 = load i32* %a, align 16
104 %cmp15 = icmp eq i32 %tmp14, 178
105 br i1 %cmp15, label %if.then, label %if.end
107 if.then: ; preds = %for.body
108 call void @abort() noreturn nounwind
111 if.end: ; preds = %for.body
114 for.inc: ; preds = %if.end
115 %indvar.next = add i64 %indvar, 1
118 for.end: ; preds = %for.cond
119 %arraydecay17 = getelementptr inbounds [128 x %struct.s1]* %arr1, i64 0, i64 0
120 %call = call i32 @foo1(%struct.s1* %arraydecay17)
124 define internal void @check_vect() nounwind uwtable noinline {
126 %a = alloca i32, align 4
127 %b = alloca i32, align 4
128 %c = alloca i32, align 4
129 %d = alloca i32, align 4
130 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
131 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
132 %tobool = icmp eq i32 %call1, 0
133 br i1 %tobool, label %if.then, label %lor.lhs.false
135 lor.lhs.false: ; preds = %entry
136 %tmp4 = load i32* %d, align 4
137 %and6 = and i32 %tmp4, 67108864
138 %cmp = icmp eq i32 %and6, 0
139 br i1 %cmp, label %if.then, label %if.end
141 if.then: ; preds = %entry, %lor.lhs.false
142 call void @exit(i32 0) noreturn nounwind
145 if.end: ; preds = %lor.lhs.false
146 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
150 declare void (i32)* @signal(i32, void (i32)*) nounwind
152 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
154 call void @exit(i32 0) noreturn nounwind
157 return: ; No predecessors!
161 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
163 %and = and i32 %__level, -2147483648
164 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
165 %cmp = icmp ult i32 %call, %__level
166 br i1 %cmp, label %if.then, label %if.end
168 if.then: ; preds = %entry
171 if.end: ; preds = %entry
172 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
173 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
174 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
175 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
176 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
177 store i32 %asmresult, i32* %__eax, align 4
178 store i32 %asmresult8, i32* %__ebx, align 4
179 store i32 %asmresult9, i32* %__ecx, align 4
180 store i32 %asmresult10, i32* %__edx, align 4
183 return: ; preds = %if.end, %if.then
184 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
188 declare void @exit(i32) noreturn nounwind
190 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
192 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
193 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
194 %tobool = icmp eq i32* %__sig, null
195 br i1 %tobool, label %if.end, label %if.then
197 if.then: ; preds = %entry
198 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
199 store i32 %asmresult1, i32* %__sig, align 4
202 if.end: ; preds = %entry, %if.then
206 !0 = metadata !{i32 -2147226032, i32 -2147226024}
207 !1 = metadata !{i32 -2147226155, i32 -2147226147}