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 vect-iv-8.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-iv-8.s > vect-iv-8.ll
6 ; ModuleID = 'vect-iv-8.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(i16 signext %X) nounwind uwtable noinline {
12 %a = alloca [26 x i8], align 16
13 %b = alloca [26 x i16], align 16
14 %c = alloca [26 x i32], align 16
15 %tmp6 = zext i16 %X to i64
18 for.cond: ; preds = %for.inc, %entry
19 %indvar3 = phi i64 [ %indvar.next4, %for.inc ], [ 0, %entry ]
20 %arrayidx13 = getelementptr [26 x i32]* %c, i64 0, i64 %indvar3
21 %arrayidx8 = getelementptr [26 x i16]* %b, i64 0, i64 %indvar3
22 %arrayidx = getelementptr [26 x i8]* %a, i64 0, i64 %indvar3
23 %tmp7 = add i64 %tmp6, %indvar3
24 %X.addr.0 = trunc i64 %tmp7 to i16
25 %conv = trunc i64 %tmp7 to i8
26 %exitcond = icmp ne i64 %indvar3, 26
27 br i1 %exitcond, label %for.body, label %for.end
29 for.body: ; preds = %for.cond
30 store i8 %conv, i8* %arrayidx, align 1
31 store i16 %X.addr.0, i16* %arrayidx8, align 2
32 %conv10 = sext i16 %X.addr.0 to i32
33 store i32 %conv10, i32* %arrayidx13, align 4
36 for.inc: ; preds = %for.body
37 %indvar.next4 = add i64 %indvar3, 1
40 for.end: ; preds = %for.cond
41 %tmp = zext i16 %X to i64
44 for.cond17: ; preds = %for.inc51, %for.end
45 %indvar = phi i64 [ %indvar.next, %for.inc51 ], [ 0, %for.end ]
46 %arrayidx44 = getelementptr [26 x i32]* %c, i64 0, i64 %indvar
47 %arrayidx34 = getelementptr [26 x i16]* %b, i64 0, i64 %indvar
48 %arrayidx24 = getelementptr [26 x i8]* %a, i64 0, i64 %indvar
49 %i.1 = trunc i64 %indvar to i32
50 %tmp1 = add i64 %tmp, %indvar
51 %myX.0 = trunc i64 %tmp1 to i16
52 %cmp19 = icmp slt i32 %i.1, 26
53 br i1 %cmp19, label %for.body21, label %for.end54
55 for.body21: ; preds = %for.cond17
56 %tmp25 = load i8* %arrayidx24, align 1
57 %conv26 = zext i8 %tmp25 to i32
58 %conv28 = zext i16 %myX.0 to i32
59 %conv29 = and i32 %conv28, 255
60 %cmp30 = icmp eq i32 %conv26, %conv29
61 br i1 %cmp30, label %lor.lhs.false, label %if.then
63 lor.lhs.false: ; preds = %for.body21
64 %tmp35 = load i16* %arrayidx34, align 2
65 %conv36 = zext i16 %tmp35 to i32
66 %conv38 = sext i16 %myX.0 to i32
67 %cmp39 = icmp eq i32 %conv36, %conv38
68 br i1 %cmp39, label %lor.lhs.false41, label %if.then
70 lor.lhs.false41: ; preds = %lor.lhs.false
71 %tmp45 = load i32* %arrayidx44, align 4
72 %conv48 = sext i16 %myX.0 to i32
73 %cmp49 = icmp eq i32 %tmp45, %conv48
74 br i1 %cmp49, label %if.end, label %if.then
76 if.then: ; preds = %lor.lhs.false41, %lor.lhs.false, %for.body21
77 call void @abort() noreturn nounwind
80 if.end: ; preds = %lor.lhs.false41
83 for.inc51: ; preds = %if.end
84 %indvar.next = add i64 %indvar, 1
87 for.end54: ; preds = %for.cond17
91 declare void @abort() noreturn
93 define i32 @main() nounwind uwtable {
95 call void @check_vect()
96 %call = call i32 @main1(i16 signext 3)
100 define internal void @check_vect() nounwind uwtable noinline {
102 %a = alloca i32, align 4
103 %b = alloca i32, align 4
104 %c = alloca i32, align 4
105 %d = alloca i32, align 4
106 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
107 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
108 %tobool = icmp eq i32 %call1, 0
109 br i1 %tobool, label %if.then, label %lor.lhs.false
111 lor.lhs.false: ; preds = %entry
112 %tmp4 = load i32* %d, align 4
113 %and6 = and i32 %tmp4, 67108864
114 %cmp = icmp eq i32 %and6, 0
115 br i1 %cmp, label %if.then, label %if.end
117 if.then: ; preds = %entry, %lor.lhs.false
118 call void @exit(i32 0) noreturn nounwind
121 if.end: ; preds = %lor.lhs.false
122 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
126 declare void (i32)* @signal(i32, void (i32)*) nounwind
128 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
130 call void @exit(i32 0) noreturn nounwind
133 return: ; No predecessors!
137 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
139 %and = and i32 %__level, -2147483648
140 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
141 %cmp = icmp ult i32 %call, %__level
142 br i1 %cmp, label %if.then, label %if.end
144 if.then: ; preds = %entry
147 if.end: ; preds = %entry
148 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
149 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
150 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
151 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
152 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
153 store i32 %asmresult, i32* %__eax, align 4
154 store i32 %asmresult8, i32* %__ebx, align 4
155 store i32 %asmresult9, i32* %__ecx, align 4
156 store i32 %asmresult10, i32* %__edx, align 4
159 return: ; preds = %if.end, %if.then
160 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
164 declare void @exit(i32) noreturn
166 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
168 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
169 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
170 %tobool = icmp eq i32* %__sig, null
171 br i1 %tobool, label %if.end, label %if.then
173 if.then: ; preds = %entry
174 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
175 store i32 %asmresult1, i32* %__sig, align 4
178 if.end: ; preds = %entry, %if.then
182 !0 = metadata !{i32 -2147343493, i32 -2147343485}
183 !1 = metadata !{i32 -2147343616, i32 -2147343608}