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-25.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer slp-25.s > slp-25.ll
6 ; ModuleID = 'slp-25.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 @ia = common global [130 x i32] zeroinitializer, align 16
11 @sa = common global [130 x i16] zeroinitializer, align 16
13 define i32 @main1(i32 %n) nounwind uwtable {
17 for.cond: ; preds = %for.inc, %entry
18 %indvar21 = phi i64 [ %indvar.next22, %for.inc ], [ 0, %entry ]
19 %tmp23 = mul i64 %indvar21, 2
20 %tmp24 = add i64 %tmp23, 3
21 %arrayidx5 = getelementptr [130 x i32]* @ia, i64 0, i64 %tmp24
22 %tmp25 = add i64 %tmp23, 2
23 %arrayidx = getelementptr [130 x i32]* @ia, i64 0, i64 %tmp25
24 %exitcond = icmp ne i64 %indvar21, 64
25 br i1 %exitcond, label %for.body, label %for.end
27 for.body: ; preds = %for.cond
28 store i32 25, i32* %arrayidx, align 8
29 store i32 5, i32* %arrayidx5, align 4
32 for.inc: ; preds = %for.body
33 %indvar.next22 = add i64 %indvar21, 1
36 for.end: ; preds = %for.cond
39 for.cond7: ; preds = %for.inc24, %for.end
40 %indvar14 = phi i64 [ %indvar.next15, %for.inc24 ], [ 0, %for.end ]
41 %tmp16 = mul i64 %indvar14, 2
42 %tmp17 = add i64 %tmp16, 3
43 %arrayidx21 = getelementptr [130 x i32]* @ia, i64 0, i64 %tmp17
44 %tmp18 = add i64 %tmp16, 2
45 %arrayidx14 = getelementptr [130 x i32]* @ia, i64 0, i64 %tmp18
46 %tmp19 = add i64 %indvar14, 1
47 %i.1 = trunc i64 %tmp19 to i32
48 %cmp9 = icmp slt i32 %i.1, 65
49 br i1 %cmp9, label %for.body10, label %for.end27
51 for.body10: ; preds = %for.cond7
52 %tmp15 = load i32* %arrayidx14, align 8
53 %cmp16 = icmp eq i32 %tmp15, 25
54 br i1 %cmp16, label %lor.lhs.false, label %if.then
56 lor.lhs.false: ; preds = %for.body10
57 %tmp22 = load i32* %arrayidx21, align 4
58 %cmp23 = icmp eq i32 %tmp22, 5
59 br i1 %cmp23, label %if.end, label %if.then
61 if.then: ; preds = %lor.lhs.false, %for.body10
62 call void @abort() noreturn nounwind
65 if.end: ; preds = %lor.lhs.false
68 for.inc24: ; preds = %if.end
69 %indvar.next15 = add i64 %indvar14, 1
72 for.end27: ; preds = %for.cond7
75 for.cond28: ; preds = %for.inc42, %for.end27
76 %indvar8 = phi i32 [ %indvar.next9, %for.inc42 ], [ 0, %for.end27 ]
77 %tmp10 = mul i32 %indvar8, 2
78 %add392 = add i32 %tmp10, 3
79 %mul34 = add i32 %tmp10, 2
80 %i.2 = add i32 %indvar8, 1
82 %cmp31 = icmp sgt i32 %i.2, %div
83 br i1 %cmp31, label %for.end45, label %for.body32
85 for.body32: ; preds = %for.cond28
86 %idxprom35 = sext i32 %mul34 to i64
87 %arrayidx36 = getelementptr inbounds [130 x i16]* @sa, i64 0, i64 %idxprom35
88 store i16 25, i16* %arrayidx36, align 4
89 %idxprom40 = sext i32 %add392 to i64
90 %arrayidx41 = getelementptr inbounds [130 x i16]* @sa, i64 0, i64 %idxprom40
91 store i16 5, i16* %arrayidx41, align 2
94 for.inc42: ; preds = %for.body32
95 %indvar.next9 = add i32 %indvar8, 1
98 for.end45: ; preds = %for.cond28
101 for.cond46: ; preds = %for.inc71, %for.end45
102 %indvar = phi i32 [ %indvar.next, %for.inc71 ], [ 0, %for.end45 ]
103 %tmp = mul i32 %indvar, 2
104 %add621 = add i32 %tmp, 3
105 %mul53 = add i32 %tmp, 2
106 %i.3 = add i32 %indvar, 1
107 %div49 = sdiv i32 %n, 2
108 %cmp50 = icmp sgt i32 %i.3, %div49
109 br i1 %cmp50, label %for.end74, label %for.body51
111 for.body51: ; preds = %for.cond46
112 %idxprom54 = sext i32 %mul53 to i64
113 %arrayidx55 = getelementptr inbounds [130 x i16]* @sa, i64 0, i64 %idxprom54
114 %tmp56 = load i16* %arrayidx55, align 4
115 %cmp57 = icmp eq i16 %tmp56, 25
116 br i1 %cmp57, label %lor.lhs.false59, label %if.then69
118 lor.lhs.false59: ; preds = %for.body51
119 %idxprom63 = sext i32 %add621 to i64
120 %arrayidx64 = getelementptr inbounds [130 x i16]* @sa, i64 0, i64 %idxprom63
121 %tmp65 = load i16* %arrayidx64, align 2
122 %cmp67 = icmp eq i16 %tmp65, 5
123 br i1 %cmp67, label %if.end70, label %if.then69
125 if.then69: ; preds = %lor.lhs.false59, %for.body51
126 call void @abort() noreturn nounwind
129 if.end70: ; preds = %lor.lhs.false59
132 for.inc71: ; preds = %if.end70
133 %indvar.next = add i32 %indvar, 1
136 for.end74: ; preds = %for.cond46
140 declare void @abort() noreturn
142 define i32 @main() nounwind uwtable {
144 call void @check_vect()
145 %call = call i32 @main1(i32 128)
149 define internal void @check_vect() nounwind uwtable noinline {
151 %a = alloca i32, align 4
152 %b = alloca i32, align 4
153 %c = alloca i32, align 4
154 %d = alloca i32, align 4
155 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
156 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
157 %tobool = icmp eq i32 %call1, 0
158 br i1 %tobool, label %if.then, label %lor.lhs.false
160 lor.lhs.false: ; preds = %entry
161 %tmp4 = load i32* %d, align 4
162 %and6 = and i32 %tmp4, 67108864
163 %cmp = icmp eq i32 %and6, 0
164 br i1 %cmp, label %if.then, label %if.end
166 if.then: ; preds = %entry, %lor.lhs.false
167 call void @exit(i32 0) noreturn nounwind
170 if.end: ; preds = %lor.lhs.false
171 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
175 declare void (i32)* @signal(i32, void (i32)*) nounwind
177 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
179 call void @exit(i32 0) noreturn nounwind
182 return: ; No predecessors!
186 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
188 %and = and i32 %__level, -2147483648
189 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
190 %cmp = icmp ult i32 %call, %__level
191 br i1 %cmp, label %if.then, label %if.end
193 if.then: ; preds = %entry
196 if.end: ; preds = %entry
197 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
198 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
199 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
200 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
201 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
202 store i32 %asmresult, i32* %__eax, align 4
203 store i32 %asmresult8, i32* %__ebx, align 4
204 store i32 %asmresult9, i32* %__ecx, align 4
205 store i32 %asmresult10, i32* %__edx, align 4
208 return: ; preds = %if.end, %if.then
209 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
213 declare void @exit(i32) noreturn
215 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
217 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
218 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
219 %tobool = icmp eq i32* %__sig, null
220 br i1 %tobool, label %if.end, label %if.then
222 if.then: ; preds = %entry
223 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
224 store i32 %asmresult1, i32* %__sig, align 4
227 if.end: ; preds = %entry, %if.then
231 !0 = metadata !{i32 -2147343231, i32 -2147343223}
232 !1 = metadata !{i32 -2147343354, i32 -2147343346}