1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -aa-pipeline='basic-aa,scoped-noalias-aa' -passes=slp-vectorizer -mtriple=x86_64-apple-darwin -S %s | FileCheck %s
4 define void @version_multiple(ptr nocapture %out_block, ptr nocapture readonly %counter) {
5 ; CHECK-LABEL: @version_multiple(
7 ; CHECK-NEXT: [[TMP0:%.*]] = load i32, ptr [[COUNTER:%.*]], align 4
8 ; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr [[OUT_BLOCK:%.*]], align 4
9 ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[TMP1]], [[TMP0]]
10 ; CHECK-NEXT: store i32 [[XOR]], ptr [[OUT_BLOCK]], align 4
11 ; CHECK-NEXT: [[ARRAYIDX_1:%.*]] = getelementptr inbounds i32, ptr [[COUNTER]], i64 1
12 ; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr [[ARRAYIDX_1]], align 4
13 ; CHECK-NEXT: [[ARRAYIDX2_1:%.*]] = getelementptr inbounds i32, ptr [[OUT_BLOCK]], i64 1
14 ; CHECK-NEXT: [[TMP3:%.*]] = load i32, ptr [[ARRAYIDX2_1]], align 4
15 ; CHECK-NEXT: [[XOR_1:%.*]] = xor i32 [[TMP3]], [[TMP2]]
16 ; CHECK-NEXT: store i32 [[XOR_1]], ptr [[ARRAYIDX2_1]], align 4
17 ; CHECK-NEXT: [[ARRAYIDX_2:%.*]] = getelementptr inbounds i32, ptr [[COUNTER]], i64 2
18 ; CHECK-NEXT: [[TMP4:%.*]] = load i32, ptr [[ARRAYIDX_2]], align 4
19 ; CHECK-NEXT: [[ARRAYIDX2_2:%.*]] = getelementptr inbounds i32, ptr [[OUT_BLOCK]], i64 2
20 ; CHECK-NEXT: [[TMP5:%.*]] = load i32, ptr [[ARRAYIDX2_2]], align 4
21 ; CHECK-NEXT: [[XOR_2:%.*]] = xor i32 [[TMP5]], [[TMP4]]
22 ; CHECK-NEXT: store i32 [[XOR_2]], ptr [[ARRAYIDX2_2]], align 4
23 ; CHECK-NEXT: [[ARRAYIDX_3:%.*]] = getelementptr inbounds i32, ptr [[COUNTER]], i64 3
24 ; CHECK-NEXT: [[TMP6:%.*]] = load i32, ptr [[ARRAYIDX_3]], align 4
25 ; CHECK-NEXT: [[ARRAYIDX2_3:%.*]] = getelementptr inbounds i32, ptr [[OUT_BLOCK]], i64 3
26 ; CHECK-NEXT: [[TMP7:%.*]] = load i32, ptr [[ARRAYIDX2_3]], align 4
27 ; CHECK-NEXT: [[XOR_3:%.*]] = xor i32 [[TMP7]], [[TMP6]]
28 ; CHECK-NEXT: store i32 [[XOR_3]], ptr [[ARRAYIDX2_3]], align 4
29 ; CHECK-NEXT: ret void
32 %0 = load i32, ptr %counter, align 4
33 %1 = load i32, ptr %out_block, align 4
35 store i32 %xor, ptr %out_block, align 4
36 %arrayidx.1 = getelementptr inbounds i32, ptr %counter, i64 1
37 %2 = load i32, ptr %arrayidx.1, align 4
38 %arrayidx2.1 = getelementptr inbounds i32, ptr %out_block, i64 1
39 %3 = load i32, ptr %arrayidx2.1, align 4
40 %xor.1 = xor i32 %3, %2
41 store i32 %xor.1, ptr %arrayidx2.1, align 4
42 %arrayidx.2 = getelementptr inbounds i32, ptr %counter, i64 2
43 %4 = load i32, ptr %arrayidx.2, align 4
44 %arrayidx2.2 = getelementptr inbounds i32, ptr %out_block, i64 2
45 %5 = load i32, ptr %arrayidx2.2, align 4
46 %xor.2 = xor i32 %5, %4
47 store i32 %xor.2, ptr %arrayidx2.2, align 4
48 %arrayidx.3 = getelementptr inbounds i32, ptr %counter, i64 3
49 %6 = load i32, ptr %arrayidx.3, align 4
50 %arrayidx2.3 = getelementptr inbounds i32, ptr %out_block, i64 3
51 %7 = load i32, ptr %arrayidx2.3, align 4
52 %xor.3 = xor i32 %7, %6
53 store i32 %xor.3, ptr %arrayidx2.3, align 4
57 declare void @use(<8 x float>)
58 define void @delete_pointer_bound(ptr %a, ptr %b, i1 %c) #0 {
59 ; CHECK-LABEL: @delete_pointer_bound(
61 ; CHECK-NEXT: [[B_10:%.*]] = getelementptr inbounds float, ptr [[B:%.*]], i64 10
62 ; CHECK-NEXT: [[B_14:%.*]] = getelementptr inbounds float, ptr [[B]], i64 14
63 ; CHECK-NEXT: br i1 [[C:%.*]], label [[THEN:%.*]], label [[ELSE:%.*]]
65 ; CHECK-NEXT: [[L0:%.*]] = load float, ptr [[B_10]], align 4
66 ; CHECK-NEXT: [[L1:%.*]] = load float, ptr [[B_14]], align 4
67 ; CHECK-NEXT: [[I2:%.*]] = insertelement <8 x float> undef, float [[L0]], i32 2
68 ; CHECK-NEXT: [[I3:%.*]] = insertelement <8 x float> [[I2]], float [[L0]], i32 3
69 ; CHECK-NEXT: [[I4:%.*]] = insertelement <8 x float> [[I3]], float [[L1]], i32 4
70 ; CHECK-NEXT: [[I7:%.*]] = insertelement <8 x float> [[I4]], float [[L1]], i32 7
71 ; CHECK-NEXT: call void @use(<8 x float> [[I7]])
72 ; CHECK-NEXT: ret void
74 ; CHECK-NEXT: [[A_8:%.*]] = getelementptr inbounds float, ptr [[A:%.*]], i64 8
75 ; CHECK-NEXT: store float 0.000000e+00, ptr [[A_8]], align 4
76 ; CHECK-NEXT: [[L6:%.*]] = load float, ptr [[B_14]], align 4
77 ; CHECK-NEXT: [[A_5:%.*]] = getelementptr inbounds float, ptr [[A]], i64 5
78 ; CHECK-NEXT: store float [[L6]], ptr [[A_5]], align 4
79 ; CHECK-NEXT: [[A_6:%.*]] = getelementptr inbounds float, ptr [[A]], i64 6
80 ; CHECK-NEXT: store <2 x float> zeroinitializer, ptr [[A_6]], align 4
81 ; CHECK-NEXT: ret void
84 %b.10 = getelementptr inbounds float, ptr %b, i64 10
85 %b.14 = getelementptr inbounds float, ptr %b, i64 14
86 br i1 %c, label %then, label %else
89 %l0 = load float, ptr %b.10, align 4
90 %l1 = load float, ptr %b.14, align 4
91 %i2 = insertelement <8 x float> undef, float %l0, i32 2
92 %i3 = insertelement <8 x float> %i2, float %l0, i32 3
93 %i4 = insertelement <8 x float> %i3, float %l1, i32 4
94 %i7 = insertelement <8 x float> %i4, float %l1, i32 7
95 call void @use(<8 x float> %i7)
99 %a.8 = getelementptr inbounds float, ptr %a, i64 8
100 store float 0.0, ptr %a.8, align 4
101 %l6 = load float, ptr %b.14, align 4
102 %a.5 = getelementptr inbounds float, ptr %a, i64 5
103 store float %l6, ptr %a.5, align 4
104 %a.6 = getelementptr inbounds float, ptr %a, i64 6
105 store float 0.0, ptr %a.6, align 4
106 %a.7 = getelementptr inbounds float, ptr %a, i64 7
107 store float 0.0, ptr %a.7, align 4
111 %struct.zot = type { i16, i16, i16, i32, float, float, float, ptr, ptr, ptr, %struct.wombat.0 }
112 %struct.quux = type { i16, ptr, ptr }
113 %struct.wombat = type { i32, i16, i8, i8, ptr }
114 %struct.eggs = type { float, i8, %struct.ham }
115 %struct.ham = type { [2 x double], [8 x i8] }
116 %struct.wombat.0 = type { %struct.bar }
117 %struct.bar = type { [3 x double], [3 x double], double, double, i16, ptr, i32, [3 x double] }
119 define double @preserve_loop_info(ptr %arg) {
120 ; CHECK-LABEL: @preserve_loop_info(
122 ; CHECK-NEXT: [[TMP:%.*]] = alloca [3 x double], align 16
123 ; CHECK-NEXT: br label [[OUTER_HEADER:%.*]]
124 ; CHECK: outer.header:
125 ; CHECK-NEXT: br label [[INNER:%.*]]
127 ; CHECK-NEXT: br i1 undef, label [[OUTER_LATCH:%.*]], label [[INNER]]
128 ; CHECK: outer.latch:
129 ; CHECK-NEXT: br i1 undef, label [[BB:%.*]], label [[OUTER_HEADER]]
131 ; CHECK-NEXT: [[TMP5:%.*]] = load ptr, ptr undef, align 8
132 ; CHECK-NEXT: [[TMP7:%.*]] = getelementptr inbounds [3 x double], ptr [[TMP]], i64 0, i64 1
133 ; CHECK-NEXT: br label [[LOOP_3HEADER:%.*]]
134 ; CHECK: loop.3header:
135 ; CHECK-NEXT: br i1 undef, label [[LOOP_3LATCH:%.*]], label [[BB9:%.*]]
137 ; CHECK-NEXT: [[TMP10:%.*]] = getelementptr inbounds [3 x double], ptr [[TMP5]], i64 undef, i64 1
138 ; CHECK-NEXT: store double undef, ptr [[TMP]], align 16
139 ; CHECK-NEXT: [[TMP12:%.*]] = load double, ptr [[TMP10]], align 8
140 ; CHECK-NEXT: store double [[TMP12]], ptr [[TMP7]], align 8
141 ; CHECK-NEXT: br label [[LOOP_3LATCH]]
142 ; CHECK: loop.3latch:
143 ; CHECK-NEXT: br i1 undef, label [[BB14:%.*]], label [[LOOP_3HEADER]]
145 ; CHECK-NEXT: [[TMP15:%.*]] = call double undef(ptr [[TMP]], ptr [[ARG:%.*]])
146 ; CHECK-NEXT: ret double undef
149 %tmp = alloca [3 x double], align 16
150 br label %outer.header
152 outer.header: ; preds = %bb3, %bb
156 br i1 undef, label %outer.latch, label %inner
158 outer.latch: ; preds = %bb16
159 br i1 undef, label %bb, label %outer.header
162 %tmp5 = load ptr, ptr undef, align 8
163 %tmp7 = getelementptr inbounds [3 x double], ptr %tmp, i64 0, i64 1
164 br label %loop.3header
166 loop.3header: ; preds = %bb13, %bb4
167 br i1 undef, label %loop.3latch, label %bb9
170 %tmp10 = getelementptr inbounds [3 x double], ptr %tmp5, i64 undef, i64 1
171 store double undef, ptr %tmp, align 16
172 %tmp12 = load double, ptr %tmp10, align 8
173 store double %tmp12, ptr %tmp7, align 8
174 br label %loop.3latch
176 loop.3latch: ; preds = %bb11, %bb8
177 br i1 undef, label %bb14, label %loop.3header
179 bb14: ; preds = %bb13
180 %tmp15 = call double undef(ptr %tmp, ptr %arg)
184 define void @gather_sequence_crash(<2 x float> %arg, ptr %arg1, float %arg2, ptr %arg3, ptr %arg4, ptr %arg5, i1 %c.1, i1 %c.2) {
185 ; CHECK-LABEL: @gather_sequence_crash(
187 ; CHECK-NEXT: br i1 [[C_1:%.*]], label [[BB16:%.*]], label [[BB6:%.*]]
189 ; CHECK-NEXT: [[TMP8:%.*]] = getelementptr inbounds float, ptr [[ARG1:%.*]], i32 3
190 ; CHECK-NEXT: [[TMP0:%.*]] = shufflevector <2 x float> [[ARG:%.*]], <2 x float> poison, <4 x i32> <i32 poison, i32 0, i32 1, i32 poison>
191 ; CHECK-NEXT: [[TMP1:%.*]] = shufflevector <4 x float> [[TMP0]], <4 x float> <float poison, float poison, float poison, float 0.000000e+00>, <4 x i32> <i32 poison, i32 1, i32 2, i32 7>
192 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <4 x float> [[TMP1]], float [[ARG2:%.*]], i32 0
193 ; CHECK-NEXT: [[TMP3:%.*]] = fmul <4 x float> [[TMP2]], zeroinitializer
194 ; CHECK-NEXT: store <4 x float> [[TMP3]], ptr [[TMP8]], align 4
195 ; CHECK-NEXT: ret void
197 ; CHECK-NEXT: br label [[BB17:%.*]]
199 ; CHECK-NEXT: br label [[BB18:%.*]]
201 ; CHECK-NEXT: br label [[BB19:%.*]]
203 ; CHECK-NEXT: br label [[BB20:%.*]]
205 ; CHECK-NEXT: br label [[BB21:%.*]]
207 ; CHECK-NEXT: br label [[BB22:%.*]]
209 ; CHECK-NEXT: [[TMP24:%.*]] = getelementptr float, ptr [[ARG4:%.*]], i64 7
210 ; CHECK-NEXT: br i1 [[C_2:%.*]], label [[BB25:%.*]], label [[BB22]]
212 ; CHECK-NEXT: [[TMP26:%.*]] = getelementptr float, ptr [[ARG4]], i64 6
213 ; CHECK-NEXT: store float 0.000000e+00, ptr [[TMP24]], align 4
214 ; CHECK-NEXT: [[TMP27:%.*]] = load float, ptr [[ARG5:%.*]], align 4
215 ; CHECK-NEXT: [[TMP29:%.*]] = fadd float 0.000000e+00, 0.000000e+00
216 ; CHECK-NEXT: store float 0.000000e+00, ptr [[TMP26]], align 4
217 ; CHECK-NEXT: [[TMP30:%.*]] = getelementptr float, ptr [[ARG4]], i64 4
218 ; CHECK-NEXT: [[TMP31:%.*]] = fadd float 0.000000e+00, 0.000000e+00
219 ; CHECK-NEXT: store <2 x float> zeroinitializer, ptr [[TMP30]], align 4
220 ; CHECK-NEXT: br label [[BB33:%.*]]
222 ; CHECK-NEXT: br label [[BB34:%.*]]
224 ; CHECK-NEXT: [[TMP35:%.*]] = getelementptr float, ptr [[ARG4]], i64 3
225 ; CHECK-NEXT: [[TMP37:%.*]] = load float, ptr [[TMP35]], align 4
226 ; CHECK-NEXT: [[TMP38:%.*]] = fadd float 0.000000e+00, [[TMP37]]
227 ; CHECK-NEXT: store float [[TMP38]], ptr [[TMP35]], align 4
228 ; CHECK-NEXT: [[TMP39:%.*]] = getelementptr float, ptr [[ARG4]], i64 1
229 ; CHECK-NEXT: [[TMP4:%.*]] = load <2 x float>, ptr [[TMP39]], align 4
230 ; CHECK-NEXT: [[TMP5:%.*]] = fadd <2 x float> zeroinitializer, [[TMP4]]
231 ; CHECK-NEXT: store <2 x float> [[TMP5]], ptr [[TMP39]], align 4
232 ; CHECK-NEXT: [[TMP44:%.*]] = load float, ptr [[ARG3:%.*]], align 4
233 ; CHECK-NEXT: [[TMP45:%.*]] = load float, ptr [[ARG4]], align 4
234 ; CHECK-NEXT: [[TMP46:%.*]] = fadd float 0.000000e+00, [[TMP45]]
235 ; CHECK-NEXT: store float [[TMP46]], ptr [[ARG4]], align 4
236 ; CHECK-NEXT: call void @quux()
237 ; CHECK-NEXT: br label [[BB47:%.*]]
239 ; CHECK-NEXT: br label [[BB17]]
242 br i1 %c.1, label %bb16, label %bb6
245 %tmp = getelementptr inbounds float, ptr %arg1, i32 4
246 %tmp7 = getelementptr inbounds float, ptr %arg1, i32 5
247 %tmp8 = getelementptr inbounds float, ptr %arg1, i32 3
248 %tmp9 = getelementptr inbounds float, ptr %arg1, i32 6
249 %tmp10 = extractelement <2 x float> %arg, i32 0
250 %tmp11 = fmul float %tmp10, 0.000000e+00
251 store float %tmp11, ptr %tmp, align 4
252 %tmp12 = extractelement <2 x float> %arg, i32 1
253 %tmp13 = fmul float %tmp12, 0.000000e+00
254 store float %tmp13, ptr %tmp7, align 4
255 %tmp14 = fmul float %arg2, 0.000000e+00
256 store float %tmp14, ptr %tmp8, align 4
257 %tmp15 = fmul float 0.000000e+00, 0.000000e+00
258 store float %tmp15, ptr %tmp9, align 4
264 bb17: ; preds = %bb47, %bb16
267 bb18: ; preds = %bb17
270 bb19: ; preds = %bb18
273 bb20: ; preds = %bb19
276 bb21: ; preds = %bb20
279 bb22: ; preds = %bb22, %bb21
280 %tmp24 = getelementptr float, ptr %arg4, i64 7
281 br i1 %c.2, label %bb25, label %bb22
283 bb25: ; preds = %bb22
284 %tmp26 = getelementptr float, ptr %arg4, i64 6
285 store float 0.000000e+00, ptr %tmp24, align 4
286 %tmp27 = load float, ptr %arg5, align 4
287 %tmp28 = getelementptr float, ptr %arg4, i64 5
288 %tmp29 = fadd float 0.000000e+00, 0.000000e+00
289 store float 0.000000e+00, ptr %tmp26, align 4
290 %tmp30 = getelementptr float, ptr %arg4, i64 4
291 store float 0.000000e+00, ptr %tmp28, align 4
292 %tmp31 = fadd float 0.000000e+00, 0.000000e+00
293 store float 0.000000e+00, ptr %tmp30, align 4
296 bb33: ; preds = %bb25
299 bb34: ; preds = %bb33
300 %tmp35 = getelementptr float, ptr %arg4, i64 3
301 %tmp36 = getelementptr float, ptr %arg4, i64 2
302 %tmp37 = load float, ptr %tmp35, align 4
303 %tmp38 = fadd float 0.000000e+00, %tmp37
304 store float %tmp38, ptr %tmp35, align 4
305 %tmp39 = getelementptr float, ptr %arg4, i64 1
306 %tmp40 = load float, ptr %tmp36, align 4
307 %tmp41 = fadd float 0.000000e+00, %tmp40
308 store float %tmp41, ptr %tmp36, align 4
309 %tmp42 = load float, ptr %tmp39, align 4
310 %tmp43 = fadd float 0.000000e+00, %tmp42
311 store float %tmp43, ptr %tmp39, align 4
312 %tmp44 = load float, ptr %arg3, align 4
313 %tmp45 = load float, ptr %arg4, align 4
314 %tmp46 = fadd float 0.000000e+00, %tmp45
315 store float %tmp46, ptr %arg4, align 4
319 bb47: ; preds = %bb34
324 attributes #0 = { "target-features"="+avx2" }