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-u8-i2-gap.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-strided-u8-i2-gap.s > vect-strided-u8-i2-gap.ll
6 ; ModuleID = 'vect-strided-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(%struct.s* %arr) nounwind uwtable noinline {
14 %res = alloca [64 x %struct.s], align 16
17 for.cond: ; preds = %for.inc, %entry
18 %indvar13 = phi i64 [ %indvar.next14, %for.inc ], [ 0, %entry ]
19 %b = getelementptr %struct.s* %arr, i64 %indvar13, i32 1
20 %b13 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar13, i32 1
21 %scevgep18 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar13
22 %a = bitcast %struct.s* %scevgep18 to i8*
23 %exitcond15 = icmp ne i64 %indvar13, 64
24 br i1 %exitcond15, label %for.body, label %for.end
26 for.body: ; preds = %for.cond
27 %tmp5 = load i8* %b, align 1
28 store i8 %tmp5, i8* %a, align 2
29 %tmp9 = load i8* %b, align 1
30 store i8 %tmp9, i8* %b13, align 1
33 for.inc: ; preds = %for.body
34 %indvar.next14 = add i64 %indvar13, 1
37 for.end: ; preds = %for.cond
40 for.cond16: ; preds = %for.inc49, %for.end
41 %indvar7 = phi i64 [ %indvar.next8, %for.inc49 ], [ 0, %for.end ]
42 %b29 = getelementptr %struct.s* %arr, i64 %indvar7, i32 1
43 %b37 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar7, i32 1
44 %scevgep11 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar7
45 %a23 = bitcast %struct.s* %scevgep11 to i8*
46 %i.1 = trunc i64 %indvar7 to i32
47 %cmp18 = icmp slt i32 %i.1, 64
48 br i1 %cmp18, label %for.body19, label %for.end52
50 for.body19: ; preds = %for.cond16
51 %tmp24 = load i8* %a23, align 2
52 %tmp30 = load i8* %b29, align 1
53 %cmp32 = icmp eq i8 %tmp24, %tmp30
54 br i1 %cmp32, label %lor.lhs.false, label %if.then
56 lor.lhs.false: ; preds = %for.body19
57 %tmp38 = load i8* %b37, align 1
58 %tmp45 = load i8* %b29, align 1
59 %cmp47 = icmp eq i8 %tmp38, %tmp45
60 br i1 %cmp47, label %if.end, label %if.then
62 if.then: ; preds = %lor.lhs.false, %for.body19
63 call void @abort() noreturn nounwind
66 if.end: ; preds = %lor.lhs.false
69 for.inc49: ; preds = %if.end
70 %indvar.next8 = add i64 %indvar7, 1
73 for.end52: ; preds = %for.cond16
76 for.cond54: ; preds = %for.inc68, %for.end52
77 %indvar2 = phi i64 [ %indvar.next3, %for.inc68 ], [ 0, %for.end52 ]
78 %b60 = getelementptr %struct.s* %arr, i64 %indvar2, i32 1
79 %scevgep5 = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar2
80 %a65 = bitcast %struct.s* %scevgep5 to i8*
81 %exitcond = icmp ne i64 %indvar2, 64
82 br i1 %exitcond, label %for.body58, label %for.end71
84 for.body58: ; preds = %for.cond54
85 %tmp61 = load i8* %b60, align 1
86 store i8 %tmp61, i8* %a65, align 2
89 for.inc68: ; preds = %for.body58
90 %indvar.next3 = add i64 %indvar2, 1
93 for.end71: ; preds = %for.cond54
96 for.cond72: ; preds = %for.inc94, %for.end71
97 %indvar = phi i64 [ %indvar.next, %for.inc94 ], [ 0, %for.end71 ]
98 %b87 = getelementptr %struct.s* %arr, i64 %indvar, i32 1
99 %scevgep = getelementptr [64 x %struct.s]* %res, i64 0, i64 %indvar
100 %a80 = bitcast %struct.s* %scevgep to i8*
101 %i.3 = trunc i64 %indvar to i32
102 %cmp74 = icmp slt i32 %i.3, 64
103 br i1 %cmp74, label %for.body76, label %for.end97
105 for.body76: ; preds = %for.cond72
106 %tmp81 = load i8* %a80, align 2
107 %tmp88 = load i8* %b87, align 1
108 %cmp90 = icmp eq i8 %tmp81, %tmp88
109 br i1 %cmp90, label %if.end93, label %if.then92
111 if.then92: ; preds = %for.body76
112 call void @abort() noreturn nounwind
115 if.end93: ; preds = %for.body76
118 for.inc94: ; preds = %if.end93
119 %indvar.next = add i64 %indvar, 1
122 for.end97: ; preds = %for.cond72
126 declare void @abort() noreturn
128 define i32 @main() nounwind uwtable {
130 %arr = alloca [64 x %struct.s], align 16
131 call void @check_vect()
134 for.cond: ; preds = %for.inc, %entry
135 %indvar = phi i64 [ %indvar.next, %for.inc ], [ 0, %entry ]
136 %tmp = mul i64 %indvar, 2
137 %conv4 = trunc i64 %tmp to i8
138 %scevgep = getelementptr [64 x %struct.s]* %arr, i64 0, i64 %indvar
139 %a = bitcast %struct.s* %scevgep to i8*
140 %b = getelementptr [64 x %struct.s]* %arr, i64 0, i64 %indvar, i32 1
141 %conv = trunc i64 %indvar to i8
142 %i.0 = trunc i64 %indvar to i32
143 %cmp = icmp slt i32 %i.0, 64
144 br i1 %cmp, label %for.body, label %for.end
146 for.body: ; preds = %for.cond
147 store i8 %conv, i8* %a, align 2
148 store i8 %conv4, i8* %b, align 1
149 %tmp12 = load i8* %a, align 2
150 %cmp14 = icmp eq i8 %tmp12, -78
151 br i1 %cmp14, label %if.then, label %if.end
153 if.then: ; preds = %for.body
154 call void @abort() noreturn nounwind
157 if.end: ; preds = %for.body
160 for.inc: ; preds = %if.end
161 %indvar.next = add i64 %indvar, 1
164 for.end: ; preds = %for.cond
165 %arraydecay = getelementptr inbounds [64 x %struct.s]* %arr, i64 0, i64 0
166 %call = call i32 @main1(%struct.s* %arraydecay)
170 define internal void @check_vect() nounwind uwtable noinline {
172 %a = alloca i32, align 4
173 %b = alloca i32, align 4
174 %c = alloca i32, align 4
175 %d = alloca i32, align 4
176 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
177 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
178 %tobool = icmp eq i32 %call1, 0
179 br i1 %tobool, label %if.then, label %lor.lhs.false
181 lor.lhs.false: ; preds = %entry
182 %tmp4 = load i32* %d, align 4
183 %and6 = and i32 %tmp4, 67108864
184 %cmp = icmp eq i32 %and6, 0
185 br i1 %cmp, label %if.then, label %if.end
187 if.then: ; preds = %entry, %lor.lhs.false
188 call void @exit(i32 0) noreturn nounwind
191 if.end: ; preds = %lor.lhs.false
192 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
196 declare void (i32)* @signal(i32, void (i32)*) nounwind
198 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
200 call void @exit(i32 0) noreturn nounwind
203 return: ; No predecessors!
207 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
209 %and = and i32 %__level, -2147483648
210 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
211 %cmp = icmp ult i32 %call, %__level
212 br i1 %cmp, label %if.then, label %if.end
214 if.then: ; preds = %entry
217 if.end: ; preds = %entry
218 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
219 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
220 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
221 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
222 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
223 store i32 %asmresult, i32* %__eax, align 4
224 store i32 %asmresult8, i32* %__ebx, align 4
225 store i32 %asmresult9, i32* %__ecx, align 4
226 store i32 %asmresult10, i32* %__edx, align 4
229 return: ; preds = %if.end, %if.then
230 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
234 declare void @exit(i32) noreturn
236 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
238 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
239 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
240 %tobool = icmp eq i32* %__sig, null
241 br i1 %tobool, label %if.end, label %if.then
243 if.then: ; preds = %entry
244 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
245 store i32 %asmresult1, i32* %__sig, align 4
248 if.end: ; preds = %entry, %if.then
252 !0 = metadata !{i32 -2147343188, i32 -2147343180}
253 !1 = metadata !{i32 -2147343311, i32 -2147343303}