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-vect-iv-2.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer no-scevccp-vect-iv-2.s > no-scevccp-vect-iv-2.ll
6 ; ModuleID = 'no-scevccp-vect-iv-2.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 i32 @main1() nounwind uwtable noinline {
12 %arr1 = alloca [16 x i32], align 16
15 do.body: ; preds = %do.cond, %entry
16 %indvar4 = phi i64 [ %indvar.next5, %do.cond ], [ 0, %entry ]
17 %arrayidx = getelementptr [16 x i32]* %arr1, i64 0, i64 %indvar4
18 %tmp8 = mul i64 %indvar4, 2
19 %tmp9 = add i64 %tmp8, 2
20 %add = trunc i64 %tmp9 to i32
21 store i32 %add, i32* %arrayidx, align 4
24 do.cond: ; preds = %do.body
25 %indvar.next5 = add i64 %indvar4, 1
26 %exitcond = icmp ne i64 %indvar.next5, 16
27 br i1 %exitcond, label %do.body, label %do.end
29 do.end: ; preds = %do.cond
32 for.cond: ; preds = %for.inc, %do.end
33 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %do.end ]
34 %tmp = mul i64 %indvar, 2
35 %tmp1 = add i64 %tmp, 2
36 %add15 = trunc i64 %tmp1 to i32
37 %arrayidx12 = getelementptr [16 x i32]* %arr1, i64 0, i64 %indvar
38 %i.1 = trunc i64 %indvar to i32
39 %cmp9 = icmp slt i32 %i.1, 16
40 br i1 %cmp9, label %for.body, label %for.end
42 for.body: ; preds = %for.cond
43 %tmp13 = load i32* %arrayidx12, align 4
44 %cmp16 = icmp eq i32 %tmp13, %add15
45 br i1 %cmp16, label %if.end, label %if.then
47 if.then: ; preds = %for.body
48 call void @abort() noreturn nounwind
51 if.end: ; preds = %for.body
54 for.inc: ; preds = %if.end
55 %indvar.next = add i64 %indvar, 1
58 for.end: ; preds = %for.cond
59 %add21 = add nsw i32 275, 32
63 declare void @abort() noreturn
65 define i32 @main() nounwind uwtable {
67 call void @check_vect()
68 %call = call i32 @main1()
69 %cmp = icmp eq i32 %call, 307
70 br i1 %cmp, label %if.end, label %if.then
72 if.then: ; preds = %entry
73 call void @abort() noreturn nounwind
76 if.end: ; preds = %entry
80 define internal void @check_vect() nounwind uwtable noinline {
82 %a = alloca i32, align 4
83 %b = alloca i32, align 4
84 %c = alloca i32, align 4
85 %d = alloca i32, align 4
86 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
87 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
88 %tobool = icmp eq i32 %call1, 0
89 br i1 %tobool, label %if.then, label %lor.lhs.false
91 lor.lhs.false: ; preds = %entry
92 %tmp4 = load i32* %d, align 4
93 %and6 = and i32 %tmp4, 67108864
94 %cmp = icmp eq i32 %and6, 0
95 br i1 %cmp, label %if.then, label %if.end
97 if.then: ; preds = %entry, %lor.lhs.false
98 call void @exit(i32 0) noreturn nounwind
101 if.end: ; preds = %lor.lhs.false
102 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
106 declare void (i32)* @signal(i32, void (i32)*) nounwind
108 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
110 call void @exit(i32 0) noreturn nounwind
113 return: ; No predecessors!
117 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
119 %and = and i32 %__level, -2147483648
120 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
121 %cmp = icmp ult i32 %call, %__level
122 br i1 %cmp, label %if.then, label %if.end
124 if.then: ; preds = %entry
127 if.end: ; preds = %entry
128 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
129 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
130 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
131 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
132 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
133 store i32 %asmresult, i32* %__eax, align 4
134 store i32 %asmresult8, i32* %__ebx, align 4
135 store i32 %asmresult9, i32* %__ecx, align 4
136 store i32 %asmresult10, i32* %__edx, align 4
139 return: ; preds = %if.end, %if.then
140 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
144 declare void @exit(i32) noreturn
146 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
148 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
149 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
150 %tobool = icmp eq i32* %__sig, null
151 br i1 %tobool, label %if.end, label %if.then
153 if.then: ; preds = %entry
154 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
155 store i32 %asmresult1, i32* %__sig, align 4
158 if.end: ; preds = %entry, %if.then
162 !0 = metadata !{i32 -2147343456, i32 -2147343448}
163 !1 = metadata !{i32 -2147343579, i32 -2147343571}