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-a-u8-i2-gap.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-strided-a-u8-i2-gap.s > vect-strided-a-u8-i2-gap.ll
6 ; ModuleID = 'vect-strided-a-u8-i2-gap.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 %arr = alloca [64 x %struct.s], align 16
15 %res = alloca [64 x %struct.s], align 16
18 for.cond: ; preds = %for.inc, %entry
19 %indvar22 = phi i64 [ %indvar.next23, %for.inc ], [ 0, %entry ]
20 %tmp = mul i64 %indvar22, 2
21 %conv4 = trunc i64 %tmp to i8
22 %scevgep26 = getelementptr [64 x %struct.s]* %arr, i64 0, i64 %indvar22
23 %a = bitcast %struct.s* %scevgep26 to i8*
24 %b = getelementptr [64 x %struct.s]* %arr, i64 0, i64 %indvar22, i32 1
25 %conv = trunc i64 %indvar22 to i8
26 %i.0 = trunc i64 %indvar22 to i32
27 %cmp = icmp slt i32 %i.0, 64
28 br i1 %cmp, label %for.body, label %for.end
30 for.body: ; preds = %for.cond
31 store i8 %conv, i8* %a, align 2
32 store i8 %conv4, i8* %b, align 1
33 %tmp12 = load i8* %a, align 2
34 %cmp14 = icmp eq i8 %tmp12, -78
35 br i1 %cmp14, label %if.then, label %if.end
37 if.then: ; preds = %for.body
38 call void @abort() noreturn nounwind
41 if.end: ; preds = %for.body
44 for.inc: ; preds = %if.end
45 %indvar.next23 = add i64 %indvar22, 1
48 for.end: ; preds = %for.cond
51 for.cond17: ; preds = %for.inc37, %for.end
52 %indvar14 = phi i64 [ %indvar.next15, %for.inc37 ], [ 0, %for.end ]
53 %b35 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar14, i32 1
54 %scevgep18 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar14
55 %a28 = bitcast %struct.s* %scevgep18 to i8*
56 %scevgep20 = getelementptr [64 x %struct.s]* %arr, i64 0, i64 %indvar14
57 %a23 = bitcast %struct.s* %scevgep20 to i8*
58 %exitcond16 = icmp ne i64 %indvar14, 64
59 br i1 %exitcond16, label %for.body21, label %for.end40
61 for.body21: ; preds = %for.cond17
62 %tmp24 = load i8* %a23, align 1
63 store i8 %tmp24, i8* %a28, align 2
64 %tmp31 = load i8* %a23, align 1
65 store i8 %tmp31, i8* %b35, align 1
68 for.inc37: ; preds = %for.body21
69 %indvar.next15 = add i64 %indvar14, 1
72 for.end40: ; preds = %for.cond17
75 for.cond41: ; preds = %for.inc76, %for.end40
76 %indvar7 = phi i64 [ %indvar.next8, %for.inc76 ], [ 0, %for.end40 ]
77 %scevgep9 = getelementptr [64 x %struct.s]* %arr, i64 0, i64 %indvar7
78 %a55 = bitcast %struct.s* %scevgep9 to i8*
79 %b63 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar7, i32 1
80 %scevgep12 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar7
81 %a49 = bitcast %struct.s* %scevgep12 to i8*
82 %i.2 = trunc i64 %indvar7 to i32
83 %cmp43 = icmp slt i32 %i.2, 64
84 br i1 %cmp43, label %for.body45, label %for.end79
86 for.body45: ; preds = %for.cond41
87 %tmp50 = load i8* %a49, align 2
88 %tmp56 = load i8* %a55, align 2
89 %cmp58 = icmp eq i8 %tmp50, %tmp56
90 br i1 %cmp58, label %lor.lhs.false, label %if.then74
92 lor.lhs.false: ; preds = %for.body45
93 %tmp64 = load i8* %b63, align 1
94 %tmp70 = load i8* %a55, align 2
95 %cmp72 = icmp eq i8 %tmp64, %tmp70
96 br i1 %cmp72, label %if.end75, label %if.then74
98 if.then74: ; preds = %lor.lhs.false, %for.body45
99 call void @abort() noreturn nounwind
102 if.end75: ; preds = %lor.lhs.false
105 for.inc76: ; preds = %if.end75
106 %indvar.next8 = add i64 %indvar7, 1
109 for.end79: ; preds = %for.cond41
112 for.cond81: ; preds = %for.inc95, %for.end79
113 %indvar2 = phi i64 [ %indvar.next3, %for.inc95 ], [ 0, %for.end79 ]
114 %scevgep4 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar2
115 %a92 = bitcast %struct.s* %scevgep4 to i8*
116 %b87 = getelementptr [64 x %struct.s]* %arr, i64 0, i64 %indvar2, i32 1
117 %exitcond = icmp ne i64 %indvar2, 64
118 br i1 %exitcond, label %for.body85, label %for.end98
120 for.body85: ; preds = %for.cond81
121 %tmp88 = load i8* %b87, align 1
122 store i8 %tmp88, i8* %a92, align 2
125 for.inc95: ; preds = %for.body85
126 %indvar.next3 = add i64 %indvar2, 1
129 for.end98: ; preds = %for.cond81
132 for.cond99: ; preds = %for.inc120, %for.end98
133 %indvar = phi i64 [ %indvar.next, %for.inc120 ], [ 0, %for.end98 ]
134 %b113 = getelementptr [64 x %struct.s]* %arr, i64 0, i64 %indvar, i32 1
135 %scevgep = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar
136 %a107 = bitcast %struct.s* %scevgep to i8*
137 %i.4 = trunc i64 %indvar to i32
138 %cmp101 = icmp slt i32 %i.4, 64
139 br i1 %cmp101, label %for.body103, label %for.end123
141 for.body103: ; preds = %for.cond99
142 %tmp108 = load i8* %a107, align 2
143 %tmp114 = load i8* %b113, align 1
144 %cmp116 = icmp eq i8 %tmp108, %tmp114
145 br i1 %cmp116, label %if.end119, label %if.then118
147 if.then118: ; preds = %for.body103
148 call void @abort() noreturn nounwind
151 if.end119: ; preds = %for.body103
154 for.inc120: ; preds = %if.end119
155 %indvar.next = add i64 %indvar, 1
158 for.end123: ; preds = %for.cond99
162 declare void @abort() noreturn
164 define i32 @main() nounwind uwtable {
166 call void @check_vect()
167 %call = call i32 @main1()
171 define internal void @check_vect() nounwind uwtable noinline {
173 %a = alloca i32, align 4
174 %b = alloca i32, align 4
175 %c = alloca i32, align 4
176 %d = alloca i32, align 4
177 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
178 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
179 %tobool = icmp eq i32 %call1, 0
180 br i1 %tobool, label %if.then, label %lor.lhs.false
182 lor.lhs.false: ; preds = %entry
183 %tmp4 = load i32* %d, align 4
184 %and6 = and i32 %tmp4, 67108864
185 %cmp = icmp eq i32 %and6, 0
186 br i1 %cmp, label %if.then, label %if.end
188 if.then: ; preds = %entry, %lor.lhs.false
189 call void @exit(i32 0) noreturn nounwind
192 if.end: ; preds = %lor.lhs.false
193 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
197 declare void (i32)* @signal(i32, void (i32)*) nounwind
199 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
201 call void @exit(i32 0) noreturn nounwind
204 return: ; No predecessors!
208 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
210 %and = and i32 %__level, -2147483648
211 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
212 %cmp = icmp ult i32 %call, %__level
213 br i1 %cmp, label %if.then, label %if.end
215 if.then: ; preds = %entry
218 if.end: ; preds = %entry
219 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
220 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
221 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
222 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
223 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
224 store i32 %asmresult, i32* %__eax, align 4
225 store i32 %asmresult8, i32* %__ebx, align 4
226 store i32 %asmresult9, i32* %__ecx, align 4
227 store i32 %asmresult10, i32* %__edx, align 4
230 return: ; preds = %if.end, %if.then
231 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
235 declare void @exit(i32) noreturn
237 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
239 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
240 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
241 %tobool = icmp eq i32* %__sig, null
242 br i1 %tobool, label %if.end, label %if.then
244 if.then: ; preds = %entry
245 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
246 store i32 %asmresult1, i32* %__sig, align 4
249 if.end: ; preds = %entry, %if.then
253 !0 = metadata !{i32 -2147343212, i32 -2147343204}
254 !1 = metadata !{i32 -2147343335, i32 -2147343327}