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-scevccp-outer-14.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer no-scevccp-outer-14.s > no-scevccp-outer-14.ll
6 ; ModuleID = 'no-scevccp-outer-14.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 define zeroext i16 @foo(i16 signext %scale) nounwind uwtable noinline {
14 for.cond: ; preds = %for.inc18, %entry
15 %sum.0 = phi i16 [ 0, %entry ], [ %conv17, %for.inc18 ]
16 %tmp = phi i32 [ 0, %entry ], [ %inc20, %for.inc18 ]
17 %exitcond1 = icmp ne i32 %tmp, 64
18 br i1 %exitcond1, label %for.body, label %for.end21
20 for.body: ; preds = %for.cond
23 for.cond1: ; preds = %for.inc, %for.body
24 %indvar = phi i32 [ %indvar.next, %for.inc ], [ 0, %for.body ]
25 %sum_j.0 = phi i32 [ 0, %for.body ], [ %phitmp, %for.inc ]
26 %exitcond = icmp ne i32 %indvar, 64
27 br i1 %exitcond, label %for.body5, label %for.end
29 for.body5: ; preds = %for.cond1
32 for.inc: ; preds = %for.body5
33 %add = add i32 %sum_j.0, %indvar
34 %phitmp = and i32 %add, 65535
35 %indvar.next = add i32 %indvar, 1
38 for.end: ; preds = %for.cond1
39 %sum_j.0.lcssa = phi i32 [ %sum_j.0, %for.cond1 ]
42 for.inc18: ; preds = %for.end
43 %conv15 = zext i16 %sum.0 to i32
44 %add16 = add nsw i32 %conv15, %sum_j.0.lcssa
45 %conv17 = trunc i32 %add16 to i16
46 %inc20 = add nsw i32 %tmp, 1
49 for.end21: ; preds = %for.cond
50 %sum.0.lcssa = phi i16 [ %sum.0, %for.cond ]
54 define zeroext i16 @bar() nounwind uwtable noinline {
58 for.cond: ; preds = %for.inc, %entry
59 %tmp = phi i16 [ 0, %entry ], [ %inc, %for.inc ]
60 %exitcond = icmp ne i16 %tmp, 64
61 br i1 %exitcond, label %for.body, label %for.end
63 for.body: ; preds = %for.cond
66 for.inc: ; preds = %for.body
67 %inc = add i16 %tmp, 1
70 for.end: ; preds = %for.cond
74 define i32 @main() nounwind uwtable {
76 call void @check_vect()
77 %call = call zeroext i16 @foo(i16 signext 2)
80 for.cond: ; preds = %for.inc, %entry
81 %tmp = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
82 %sum.0 = phi i32 [ 0, %entry ], [ %phitmp, %for.inc ]
83 %exitcond = icmp ne i32 %tmp, 64
84 br i1 %exitcond, label %for.body, label %for.end
86 for.body: ; preds = %for.cond
87 %call1 = call zeroext i16 @bar()
90 for.inc: ; preds = %for.body
91 %conv = zext i16 %call1 to i32
92 %add = add nsw i32 %sum.0, %conv
93 %inc = add nsw i32 %tmp, 1
94 %phitmp = and i32 %add, 65535
97 for.end: ; preds = %for.cond
98 %sum.0.lcssa = phi i32 [ %sum.0, %for.cond ]
99 %conv8 = zext i16 %call to i32
100 %cmp11 = icmp eq i32 %conv8, %sum.0.lcssa
101 br i1 %cmp11, label %if.end, label %if.then
103 if.then: ; preds = %for.end
104 call void @abort() noreturn nounwind
107 if.end: ; preds = %for.end
111 define internal void @check_vect() nounwind uwtable noinline {
113 %a = alloca i32, align 4
114 %b = alloca i32, align 4
115 %c = alloca i32, align 4
116 %d = alloca i32, align 4
117 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
118 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
119 %tobool = icmp eq i32 %call1, 0
120 br i1 %tobool, label %if.then, label %lor.lhs.false
122 lor.lhs.false: ; preds = %entry
123 %tmp4 = load i32* %d, align 4
124 %and6 = and i32 %tmp4, 67108864
125 %cmp = icmp eq i32 %and6, 0
126 br i1 %cmp, label %if.then, label %if.end
128 if.then: ; preds = %entry, %lor.lhs.false
129 call void @exit(i32 0) noreturn nounwind
132 if.end: ; preds = %lor.lhs.false
133 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
137 declare void @abort() noreturn
139 declare void (i32)* @signal(i32, void (i32)*) nounwind
141 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
143 call void @exit(i32 0) noreturn nounwind
146 return: ; No predecessors!
150 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
152 %and = and i32 %__level, -2147483648
153 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
154 %cmp = icmp ult i32 %call, %__level
155 br i1 %cmp, label %if.then, label %if.end
157 if.then: ; preds = %entry
160 if.end: ; preds = %entry
161 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
162 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
163 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
164 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
165 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
166 store i32 %asmresult, i32* %__eax, align 4
167 store i32 %asmresult8, i32* %__ebx, align 4
168 store i32 %asmresult9, i32* %__ecx, align 4
169 store i32 %asmresult10, i32* %__edx, align 4
172 return: ; preds = %if.end, %if.then
173 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
177 declare void @exit(i32) noreturn
179 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
181 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
182 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
183 %tobool = icmp eq i32* %__sig, null
184 br i1 %tobool, label %if.end, label %if.then
186 if.then: ; preds = %entry
187 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
188 store i32 %asmresult1, i32* %__sig, align 4
191 if.end: ; preds = %entry, %if.then
195 !0 = metadata !{i32 -2147343304, i32 -2147343296}
196 !1 = metadata !{i32 -2147343427, i32 -2147343419}