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-mult-char-ls.c
4 ; opt -correlated-propagation -mem2reg -instcombine -loop-simplify -indvars -instnamer vect-strided-mult-char-ls.s > vect-strided-mult-char-ls.ll
6 ; ModuleID = 'vect-strided-mult-char-ls.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 }
11 %struct.ii = type { i32, i32 }
13 define i32 @main1(%struct.s* %arr, %struct.ii* %iarr) nounwind uwtable noinline {
15 %res = alloca [32 x %struct.s], align 16
16 %ires = alloca [32 x %struct.ii], align 16
19 for.cond: ; preds = %for.inc, %entry
20 %indvar12 = phi i64 [ %indvar.next13, %for.inc ], [ 0, %entry ]
21 %scevgep14 = getelementptr %struct.s* %arr, i64 %indvar12
22 %a21 = bitcast %struct.s* %scevgep14 to i8*
23 %b18 = getelementptr %struct.s* %arr, i64 %indvar12, i32 1
24 %scevgep17 = getelementptr %struct.ii* %iarr, i64 %indvar12
25 %a11 = bitcast %struct.ii* %scevgep17 to i32*
26 %b = getelementptr %struct.ii* %iarr, i64 %indvar12, i32 1
27 %scevgep20 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar12
28 %a41 = bitcast %struct.s* %scevgep20 to i8*
29 %b28 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar12, i32 1
30 %b16 = getelementptr [32 x %struct.ii]* %ires, i64 0, i64 %indvar12, i32 1
31 %scevgep24 = getelementptr [32 x %struct.ii]* %ires, i64 0, i64 %indvar12
32 %a = bitcast %struct.ii* %scevgep24 to i32*
33 %exitcond = icmp ne i64 %indvar12, 32
34 br i1 %exitcond, label %for.body, label %for.end
36 for.body: ; preds = %for.cond
37 %tmp8 = load i32* %b, align 4
38 store i32 %tmp8, i32* %a, align 8
39 %tmp12 = load i32* %a11, align 4
40 store i32 %tmp12, i32* %b16, align 4
41 %tmp19 = load i8* %b18, align 1
42 %tmp22 = load i8* %a21, align 1
43 %sub = sub i8 %tmp19, %tmp22
44 store i8 %sub, i8* %b28, align 1
45 %tmp31 = load i8* %b18, align 1
46 %tmp35 = load i8* %a21, align 1
47 %add = add i8 %tmp31, %tmp35
48 store i8 %add, i8* %a41, align 2
51 for.inc: ; preds = %for.body
52 %indvar.next13 = add i64 %indvar12, 1
55 for.end: ; preds = %for.cond
58 for.cond46: ; preds = %for.inc125, %for.end
59 %indvar = phi i64 [ %indvar.next, %for.inc125 ], [ 0, %for.end ]
60 %scevgep = getelementptr %struct.ii* %iarr, i64 %indvar
61 %a121 = bitcast %struct.ii* %scevgep to i32*
62 %b115 = getelementptr [32 x %struct.ii]* %ires, i64 0, i64 %indvar, i32 1
63 %scevgep3 = getelementptr %struct.s* %arr, i64 %indvar
64 %a68 = bitcast %struct.s* %scevgep3 to i8*
65 %b61 = getelementptr %struct.s* %arr, i64 %indvar, i32 1
66 %scevgep6 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar
67 %a91 = bitcast %struct.s* %scevgep6 to i8*
68 %b83 = getelementptr %struct.ii* %iarr, i64 %indvar, i32 1
69 %scevgep9 = getelementptr [32 x %struct.ii]* %ires, i64 0, i64 %indvar
70 %a77 = bitcast %struct.ii* %scevgep9 to i32*
71 %b54 = getelementptr [32 x %struct.s]* %res, i64 0, i64 %indvar, i32 1
72 %i.1 = trunc i64 %indvar to i32
73 %cmp48 = icmp slt i32 %i.1, 32
74 br i1 %cmp48, label %for.body50, label %for.end128
76 for.body50: ; preds = %for.cond46
77 %tmp55 = load i8* %b54, align 1
78 %conv56 = zext i8 %tmp55 to i32
79 %tmp62 = load i8* %b61, align 1
80 %conv63 = zext i8 %tmp62 to i32
81 %tmp69 = load i8* %a68, align 1
82 %conv70 = zext i8 %tmp69 to i32
83 %sub71 = sub nsw i32 %conv63, %conv70
84 %cmp72 = icmp eq i32 %conv56, %sub71
85 br i1 %cmp72, label %lor.lhs.false, label %if.then
87 lor.lhs.false: ; preds = %for.body50
88 %tmp78 = load i32* %a77, align 8
89 %tmp84 = load i32* %b83, align 4
90 %cmp85 = icmp eq i32 %tmp78, %tmp84
91 br i1 %cmp85, label %lor.lhs.false87, label %if.then
93 lor.lhs.false87: ; preds = %lor.lhs.false
94 %tmp92 = load i8* %a91, align 2
95 %conv93 = zext i8 %tmp92 to i32
96 %tmp99 = load i8* %b61, align 1
97 %conv100 = zext i8 %tmp99 to i32
98 %tmp106 = load i8* %a68, align 1
99 %conv107 = zext i8 %tmp106 to i32
100 %add108 = add nsw i32 %conv100, %conv107
101 %cmp109 = icmp eq i32 %conv93, %add108
102 br i1 %cmp109, label %lor.lhs.false111, label %if.then
104 lor.lhs.false111: ; preds = %lor.lhs.false87
105 %tmp116 = load i32* %b115, align 4
106 %tmp122 = load i32* %a121, align 4
107 %cmp123 = icmp eq i32 %tmp116, %tmp122
108 br i1 %cmp123, label %if.end, label %if.then
110 if.then: ; preds = %lor.lhs.false111, %lor.lhs.false87, %lor.lhs.false, %for.body50
111 call void @abort() noreturn nounwind
114 if.end: ; preds = %lor.lhs.false111
117 for.inc125: ; preds = %if.end
118 %indvar.next = add i64 %indvar, 1
121 for.end128: ; preds = %for.cond46
125 declare void @abort() noreturn
127 define i32 @main() nounwind uwtable {
129 %arr = alloca [32 x %struct.s], align 16
130 %iarr = alloca [32 x %struct.ii], 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 [32 x %struct.s]* %arr, i64 0, i64 %indvar
139 %a = bitcast %struct.s* %scevgep to i8*
140 %b18 = getelementptr [32 x %struct.ii]* %iarr, i64 0, i64 %indvar, i32 1
141 %tmp4 = mul i64 %indvar, 3
142 %mul14 = trunc i64 %tmp4 to i32
143 %scevgep6 = getelementptr [32 x %struct.ii]* %iarr, i64 0, i64 %indvar
144 %a12 = bitcast %struct.ii* %scevgep6 to i32*
145 %i.0 = trunc i64 %indvar to i32
146 %b = getelementptr [32 x %struct.s]* %arr, i64 0, i64 %indvar, i32 1
147 %conv = trunc i64 %indvar to i8
148 %cmp = icmp slt i32 %i.0, 32
149 br i1 %cmp, label %for.body, label %for.end
151 for.body: ; preds = %for.cond
152 store i8 %conv, i8* %a, align 2
153 store i8 %conv4, i8* %b, align 1
154 store i32 %i.0, i32* %a12, align 8
155 store i32 %mul14, i32* %b18, align 4
156 %tmp23 = load i8* %a, align 2
157 %cmp25 = icmp eq i8 %tmp23, -78
158 br i1 %cmp25, label %if.then, label %if.end
160 if.then: ; preds = %for.body
161 call void @abort() noreturn nounwind
164 if.end: ; preds = %for.body
167 for.inc: ; preds = %if.end
168 %indvar.next = add i64 %indvar, 1
171 for.end: ; preds = %for.cond
172 %arraydecay = getelementptr inbounds [32 x %struct.s]* %arr, i64 0, i64 0
173 %arraydecay28 = getelementptr inbounds [32 x %struct.ii]* %iarr, i64 0, i64 0
174 %call = call i32 @main1(%struct.s* %arraydecay, %struct.ii* %arraydecay28)
178 define internal void @check_vect() nounwind uwtable noinline {
180 %a = alloca i32, align 4
181 %b = alloca i32, align 4
182 %c = alloca i32, align 4
183 %d = alloca i32, align 4
184 %call = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* @sig_ill_handler) nounwind
185 %call1 = call i32 @__get_cpuid(i32 1, i32* %a, i32* %b, i32* %c, i32* %d)
186 %tobool = icmp eq i32 %call1, 0
187 br i1 %tobool, label %if.then, label %lor.lhs.false
189 lor.lhs.false: ; preds = %entry
190 %tmp4 = load i32* %d, align 4
191 %and6 = and i32 %tmp4, 67108864
192 %cmp = icmp eq i32 %and6, 0
193 br i1 %cmp, label %if.then, label %if.end
195 if.then: ; preds = %entry, %lor.lhs.false
196 call void @exit(i32 0) noreturn nounwind
199 if.end: ; preds = %lor.lhs.false
200 %call7 = call void (i32)* (i32, void (i32)*)* @signal(i32 4, void (i32)* null) nounwind
204 declare void (i32)* @signal(i32, void (i32)*) nounwind
206 define internal void @sig_ill_handler(i32 %sig) nounwind uwtable {
208 call void @exit(i32 0) noreturn nounwind
211 return: ; No predecessors!
215 define internal i32 @__get_cpuid(i32 %__level, i32* %__eax, i32* %__ebx, i32* %__ecx, i32* %__edx) nounwind uwtable inlinehint {
217 %and = and i32 %__level, -2147483648
218 %call = call i32 @__get_cpuid_max(i32 %and, i32* null)
219 %cmp = icmp ult i32 %call, %__level
220 br i1 %cmp, label %if.then, label %if.end
222 if.then: ; preds = %entry
225 if.end: ; preds = %entry
226 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__level) nounwind, !srcloc !0
227 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
228 %asmresult8 = extractvalue { i32, i32, i32, i32 } %tmp, 1
229 %asmresult9 = extractvalue { i32, i32, i32, i32 } %tmp, 2
230 %asmresult10 = extractvalue { i32, i32, i32, i32 } %tmp, 3
231 store i32 %asmresult, i32* %__eax, align 4
232 store i32 %asmresult8, i32* %__ebx, align 4
233 store i32 %asmresult9, i32* %__ecx, align 4
234 store i32 %asmresult10, i32* %__edx, align 4
237 return: ; preds = %if.end, %if.then
238 %retval.0 = phi i32 [ 0, %if.then ], [ 1, %if.end ]
242 declare void @exit(i32) noreturn
244 define internal i32 @__get_cpuid_max(i32 %__ext, i32* %__sig) nounwind uwtable inlinehint {
246 %tmp = call { i32, i32, i32, i32 } asm "cpuid\0A\09", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %__ext) nounwind, !srcloc !1
247 %asmresult = extractvalue { i32, i32, i32, i32 } %tmp, 0
248 %tobool = icmp eq i32* %__sig, null
249 br i1 %tobool, label %if.end, label %if.then
251 if.then: ; preds = %entry
252 %asmresult1 = extractvalue { i32, i32, i32, i32 } %tmp, 1
253 store i32 %asmresult1, i32* %__sig, align 4
256 if.end: ; preds = %entry, %if.then
260 !0 = metadata !{i32 -2147343084, i32 -2147343076}
261 !1 = metadata !{i32 -2147343207, i32 -2147343199}