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 wrapv-vect-7.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer wrapv-vect-7.s > wrapv-vect-7.ll
6 ; ModuleID = 'wrapv-vect-7.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 @sb = common global [128 x i16] zeroinitializer, align 16
11 @sa = common global [128 x i16] zeroinitializer, align 16
13 define i32 @main1() nounwind uwtable {
17 for.cond: ; preds = %for.inc, %entry
18 %indvar6 = phi i64 [ %indvar.next7, %for.inc ], [ 0, %entry ]
19 %arrayidx = getelementptr [128 x i16]* @sb, i64 0, i64 %indvar6
20 %exitcond8 = icmp ne i64 %indvar6, 128
21 br i1 %exitcond8, label %for.body, label %for.end
23 for.body: ; preds = %for.cond
24 store i16 5, i16* %arrayidx, align 2
27 for.inc: ; preds = %for.body
28 %indvar.next7 = add i64 %indvar6, 1
31 for.end: ; preds = %for.cond
34 for.cond3: ; preds = %for.inc13, %for.end
35 %indvar4 = phi i64 [ %indvar.next5, %for.inc13 ], [ 0, %for.end ]
36 %arrayidx9 = getelementptr [128 x i16]* @sb, i64 0, i64 %indvar4
37 %i.1 = trunc i64 %indvar4 to i32
38 %cmp5 = icmp slt i32 %i.1, 128
39 br i1 %cmp5, label %for.body6, label %for.end16
41 for.body6: ; preds = %for.cond3
42 %tmp10 = load i16* %arrayidx9, align 2
43 %cmp11 = icmp eq i16 %tmp10, 5
44 br i1 %cmp11, label %if.end, label %if.then
46 if.then: ; preds = %for.body6
47 call void @abort() noreturn nounwind
50 if.end: ; preds = %for.body6
53 for.inc13: ; preds = %if.end
54 %indvar.next5 = add i64 %indvar4, 1
57 for.end16: ; preds = %for.cond3
60 for.cond17: ; preds = %for.inc31, %for.end16
61 %indvar2 = phi i64 [ %indvar.next3, %for.inc31 ], [ 0, %for.end16 ]
62 %arrayidx30 = getelementptr [128 x i16]* @sa, i64 0, i64 %indvar2
63 %arrayidx24 = getelementptr [128 x i16]* @sb, i64 0, i64 %indvar2
64 %exitcond = icmp ne i64 %indvar2, 128
65 br i1 %exitcond, label %for.body21, label %for.end34
67 for.body21: ; preds = %for.cond17
68 %tmp25 = load i16* %arrayidx24, align 2
69 %add = add i16 %tmp25, 100
70 store i16 %add, i16* %arrayidx30, align 2
73 for.inc31: ; preds = %for.body21
74 %indvar.next3 = add i64 %indvar2, 1
77 for.end34: ; preds = %for.cond17
80 for.cond35: ; preds = %for.inc49, %for.end34
81 %indvar = phi i64 [ %indvar.next, %for.inc49 ], [ 0, %for.end34 ]
82 %arrayidx42 = getelementptr [128 x i16]* @sa, i64 0, i64 %indvar
83 %i.3 = trunc i64 %indvar to i32
84 %cmp37 = icmp slt i32 %i.3, 128
85 br i1 %cmp37, label %for.body39, label %for.end52
87 for.body39: ; preds = %for.cond35
88 %tmp43 = load i16* %arrayidx42, align 2
89 %cmp45 = icmp eq i16 %tmp43, 105
90 br i1 %cmp45, label %if.end48, label %if.then47
92 if.then47: ; preds = %for.body39
93 call void @abort() noreturn nounwind
96 if.end48: ; preds = %for.body39
99 for.inc49: ; preds = %if.end48
100 %indvar.next = add i64 %indvar, 1
103 for.end52: ; preds = %for.cond35
107 declare void @abort() noreturn
109 define i32 @main() nounwind uwtable {
111 call void @check_vect()
112 %call = call i32 @main1()
116 define internal void @check_vect() nounwind uwtable noinline {
118 %a = alloca i32, align 4
119 %b = alloca i32, align 4
120 %c = alloca i32, align 4
121 %d = alloca i32, align 4
122 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
123 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
124 %tobool = icmp eq i32 %call1, 0
125 br i1 %tobool, label %if.then, label %lor.lhs.false
127 lor.lhs.false: ; preds = %entry
128 %tmp4 = load i32* %d, align 4
129 %and6 = and i32 %tmp4, 67108864
130 %cmp = icmp eq i32 %and6, 0
131 br i1 %cmp, label %if.then, label %if.end
133 if.then: ; preds = %entry, %lor.lhs.false
134 call void @exit(i32 0) noreturn nounwind
137 if.end: ; preds = %lor.lhs.false
138 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
142 declare void (i32)* @signal(i32, void (i32)*) nounwind
144 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
146 call void @exit(i32 0) noreturn nounwind
149 return: ; No predecessors!
153 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
155 %and = and i32 %__level, -2147483648
156 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
157 %cmp = icmp ult i32 %call, %__level
158 br i1 %cmp, label %if.then, label %if.end
160 if.then: ; preds = %entry
163 if.end: ; preds = %entry
164 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
165 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
166 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
167 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
168 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
169 store i32 %asmresult, i32* %__eax, align 4
170 store i32 %asmresult8, i32* %__ebx, align 4
171 store i32 %asmresult9, i32* %__ecx, align 4
172 store i32 %asmresult10, i32* %__edx, align 4
175 return: ; preds = %if.end, %if.then
176 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
180 declare void @exit(i32) noreturn
182 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
184 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
185 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
186 %tobool = icmp eq i32* %__sig, null
187 br i1 %tobool, label %if.end, label %if.then
189 if.then: ; preds = %entry
190 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
191 store i32 %asmresult1, i32* %__sig, align 4
194 if.end: ; preds = %entry, %if.then
198 !0 = metadata !{i32 -2147343476, i32 -2147343468}
199 !1 = metadata !{i32 -2147343599, i32 -2147343591}