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-strided-store-a-u8-i2.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-strided-store-a-u8-i2.s > vect-strided-store-a-u8-i2.ll
6 ; ModuleID = 'vect-strided-store-a-u8-i2.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 %struct.s = type { i8, i8 }
12 define i32 @main1() nounwind uwtable noinline {
14 %res = alloca [64 x %struct.s], align 16
15 %a = alloca [64 x i8], align 16
16 %b = alloca [64 x i8], align 16
19 for.cond: ; preds = %for.inc, %entry
20 %indvar9 = phi i64 [ %indvar.next10, %for.inc ], [ 0, %entry ]
21 %tmp = mul i64 %indvar9, 2
22 %conv4 = trunc i64 %tmp to i8
23 %arrayidx = getelementptr [64 x i8]* %a, i64 0, i64 %indvar9
24 %i.0 = trunc i64 %indvar9 to i32
25 %arrayidx7 = getelementptr [64 x i8]* %b, i64 0, i64 %indvar9
26 %conv = trunc i64 %indvar9 to i8
27 %exitcond11 = icmp ne i64 %indvar9, 64
28 br i1 %exitcond11, label %for.body, label %for.end
30 for.body: ; preds = %for.cond
31 store i8 %conv, i8* %arrayidx, align 1
32 store i8 %conv4, i8* %arrayidx7, align 1
33 %rem = srem i32 %i.0, 3
34 %cmp9 = icmp eq i32 %rem, 0
35 br i1 %cmp9, label %if.then, label %if.end
37 if.then: ; preds = %for.body
38 store i8 10, i8* %arrayidx, align 1
41 if.end: ; preds = %if.then, %for.body
44 for.inc: ; preds = %if.end
45 %indvar.next10 = add i64 %indvar9, 1
48 for.end: ; preds = %for.cond
51 for.cond15: ; preds = %for.inc47, %for.end
52 %indvar2 = phi i64 [ %indvar.next3, %for.inc47 ], [ 0, %for.end ]
53 %b45 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar2, i32 1
54 %arrayidx37 = getelementptr [64 x i8]* %b, i64 0, i64 %indvar2
55 %arrayidx22 = getelementptr [64 x i8]* %a, i64 0, i64 %indvar2
56 %scevgep7 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar2
57 %a29 = bitcast %struct.s* %scevgep7 to i8*
58 %exitcond = icmp ne i64 %indvar2, 64
59 br i1 %exitcond, label %for.body19, label %for.end50
61 for.body19: ; preds = %for.cond15
62 %tmp23 = load i8* %arrayidx22, align 1
63 %add = add i8 %tmp23, 3
64 store i8 %add, i8* %a29, align 2
65 %tmp33 = load i8* %arrayidx22, align 1
66 %tmp38 = load i8* %arrayidx37, align 1
67 %add40 = add i8 %tmp33, %tmp38
68 store i8 %add40, i8* %b45, align 1
71 for.inc47: ; preds = %for.body19
72 %indvar.next3 = add i64 %indvar2, 1
75 for.end50: ; preds = %for.cond15
78 for.cond51: ; preds = %for.inc91, %for.end50
79 %indvar = phi i64 [ %indvar.next, %for.inc91 ], [ 0, %for.end50 ]
80 %arrayidx83 = getelementptr [64 x i8]* %b, i64 0, i64 %indvar
81 %arrayidx64 = getelementptr [64 x i8]* %a, i64 0, i64 %indvar
82 %b73 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar, i32 1
83 %scevgep = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar
84 %a59 = bitcast %struct.s* %scevgep to i8*
85 %i.2 = trunc i64 %indvar to i32
86 %cmp53 = icmp slt i32 %i.2, 64
87 br i1 %cmp53, label %for.body55, label %for.end94
89 for.body55: ; preds = %for.cond51
90 %tmp60 = load i8* %a59, align 2
91 %conv61 = zext i8 %tmp60 to i32
92 %tmp65 = load i8* %arrayidx64, align 1
93 %conv66 = zext i8 %tmp65 to i32
94 %add67 = add nsw i32 %conv66, 3
95 %cmp68 = icmp eq i32 %conv61, %add67
96 br i1 %cmp68, label %lor.lhs.false, label %if.then89
98 lor.lhs.false: ; preds = %for.body55
99 %tmp74 = load i8* %b73, align 1
100 %conv75 = zext i8 %tmp74 to i32
101 %tmp79 = load i8* %arrayidx64, align 1
102 %conv80 = zext i8 %tmp79 to i32
103 %tmp84 = load i8* %arrayidx83, align 1
104 %conv85 = zext i8 %tmp84 to i32
105 %add86 = add nsw i32 %conv80, %conv85
106 %cmp87 = icmp eq i32 %conv75, %add86
107 br i1 %cmp87, label %if.end90, label %if.then89
109 if.then89: ; preds = %lor.lhs.false, %for.body55
110 call void @abort() noreturn nounwind
113 if.end90: ; preds = %lor.lhs.false
116 for.inc91: ; preds = %if.end90
117 %indvar.next = add i64 %indvar, 1
120 for.end94: ; preds = %for.cond51
124 declare void @abort() noreturn
126 define i32 @main() nounwind uwtable {
128 call void @check_vect()
129 %call = call i32 @main1()
133 define internal void @check_vect() nounwind uwtable noinline {
135 %a = alloca i32, align 4
136 %b = alloca i32, align 4
137 %c = alloca i32, align 4
138 %d = alloca i32, align 4
139 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
140 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
141 %tobool = icmp eq i32 %call1, 0
142 br i1 %tobool, label %if.then, label %lor.lhs.false
144 lor.lhs.false: ; preds = %entry
145 %tmp4 = load i32* %d, align 4
146 %and6 = and i32 %tmp4, 67108864
147 %cmp = icmp eq i32 %and6, 0
148 br i1 %cmp, label %if.then, label %if.end
150 if.then: ; preds = %entry, %lor.lhs.false
151 call void @exit(i32 0) noreturn nounwind
154 if.end: ; preds = %lor.lhs.false
155 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
159 declare void (i32)* @signal(i32, void (i32)*) nounwind
161 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
163 call void @exit(i32 0) noreturn nounwind
166 return: ; No predecessors!
170 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
172 %and = and i32 %__level, -2147483648
173 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
174 %cmp = icmp ult i32 %call, %__level
175 br i1 %cmp, label %if.then, label %if.end
177 if.then: ; preds = %entry
180 if.end: ; preds = %entry
181 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
182 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
183 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
184 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
185 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
186 store i32 %asmresult, i32* %__eax, align 4
187 store i32 %asmresult8, i32* %__ebx, align 4
188 store i32 %asmresult9, i32* %__ecx, align 4
189 store i32 %asmresult10, i32* %__edx, align 4
192 return: ; preds = %if.end, %if.then
193 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
197 declare void @exit(i32) noreturn
199 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
201 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
202 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
203 %tobool = icmp eq i32* %__sig, null
204 br i1 %tobool, label %if.end, label %if.then
206 if.then: ; preds = %entry
207 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
208 store i32 %asmresult1, i32* %__sig, align 4
211 if.end: ; preds = %entry, %if.then
215 !0 = metadata !{i32 -2147343406, i32 -2147343398}
216 !1 = metadata !{i32 -2147343529, i32 -2147343521}