@@ -180,3 +180,234 @@ loop:
180
180
exit:
181
181
ret void
182
182
}
183
+
184
+ ; Tests with accesses with strides with different signs.
185
+ define void @strides_with_different_directions_1 (ptr %A ) {
186
+ ; CHECK-LABEL: 'strides_with_different_directions_1'
187
+ ; CHECK-NEXT: loop:
188
+ ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
189
+ ; CHECK-NEXT: Unknown data dependence.
190
+ ; CHECK-NEXT: Dependences:
191
+ ; CHECK-NEXT: Unknown:
192
+ ; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->
193
+ ; CHECK-NEXT: store i32 %add, ptr %gep, align 4
194
+ ; CHECK-EMPTY:
195
+ ; CHECK-NEXT: Run-time memory checks:
196
+ ; CHECK-NEXT: Grouped accesses:
197
+ ; CHECK-EMPTY:
198
+ ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
199
+ ; CHECK-NEXT: SCEV assumptions:
200
+ ; CHECK-EMPTY:
201
+ ; CHECK-NEXT: Expressions re-written:
202
+ ;
203
+ entry:
204
+ br label %loop
205
+
206
+ loop:
207
+ %iv.1 = phi i64 [ 0 , %entry ], [ %iv.1.next , %loop ]
208
+ %iv.2 = phi i64 [ 300 , %entry ], [ %iv.2.next , %loop ]
209
+ %gep.mul.2 = getelementptr inbounds i32 , ptr %A , i64 %iv.1
210
+ %l = load i32 , ptr %gep.mul.2 , align 4
211
+ %add = add nsw i32 %l , 5
212
+ %gep = getelementptr inbounds i32 , ptr %A , i64 %iv.2
213
+ store i32 %add , ptr %gep , align 4
214
+ %iv.1.next = add nuw nsw i64 %iv.1 , 1
215
+ %iv.2.next = add nsw i64 %iv.2 , -1
216
+ %exitcond.not = icmp eq i64 %iv.1.next , 256
217
+ br i1 %exitcond.not , label %exit , label %loop
218
+
219
+ exit:
220
+ ret void
221
+ }
222
+
223
+ define void @strides_with_different_directions_2 (ptr %A ) {
224
+ ; CHECK-LABEL: 'strides_with_different_directions_2'
225
+ ; CHECK-NEXT: loop:
226
+ ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
227
+ ; CHECK-NEXT: Unknown data dependence.
228
+ ; CHECK-NEXT: Dependences:
229
+ ; CHECK-NEXT: Unknown:
230
+ ; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->
231
+ ; CHECK-NEXT: store i32 %add, ptr %gep, align 4
232
+ ; CHECK-EMPTY:
233
+ ; CHECK-NEXT: Run-time memory checks:
234
+ ; CHECK-NEXT: Grouped accesses:
235
+ ; CHECK-EMPTY:
236
+ ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
237
+ ; CHECK-NEXT: SCEV assumptions:
238
+ ; CHECK-EMPTY:
239
+ ; CHECK-NEXT: Expressions re-written:
240
+ ;
241
+ entry:
242
+ br label %loop
243
+
244
+ loop:
245
+ %iv.1 = phi i64 [ 0 , %entry ], [ %iv.1.next , %loop ]
246
+ %iv.2 = phi i64 [ 300 , %entry ], [ %iv.2.next , %loop ]
247
+ %gep.mul.2 = getelementptr inbounds i32 , ptr %A , i64 %iv.2
248
+ %l = load i32 , ptr %gep.mul.2 , align 4
249
+ %add = add nsw i32 %l , 5
250
+ %gep = getelementptr inbounds i32 , ptr %A , i64 %iv.1
251
+ store i32 %add , ptr %gep , align 4
252
+ %iv.1.next = add nuw nsw i64 %iv.1 , 1
253
+ %iv.2.next = add nsw i64 %iv.2 , -1
254
+ %exitcond.not = icmp eq i64 %iv.1.next , 256
255
+ br i1 %exitcond.not , label %exit , label %loop
256
+
257
+ exit:
258
+ ret void
259
+ }
260
+
261
+ define void @strides_with_different_directions_3 (ptr %A ) {
262
+ ; CHECK-LABEL: 'strides_with_different_directions_3'
263
+ ; CHECK-NEXT: loop:
264
+ ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
265
+ ; CHECK-NEXT: Unknown data dependence.
266
+ ; CHECK-NEXT: Dependences:
267
+ ; CHECK-NEXT: Unknown:
268
+ ; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->
269
+ ; CHECK-NEXT: store i32 %add, ptr %gep, align 4
270
+ ; CHECK-EMPTY:
271
+ ; CHECK-NEXT: Run-time memory checks:
272
+ ; CHECK-NEXT: Grouped accesses:
273
+ ; CHECK-EMPTY:
274
+ ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
275
+ ; CHECK-NEXT: SCEV assumptions:
276
+ ; CHECK-EMPTY:
277
+ ; CHECK-NEXT: Expressions re-written:
278
+ ;
279
+ entry:
280
+ br label %loop
281
+
282
+ loop:
283
+ %iv.1 = phi i64 [ 0 , %entry ], [ %iv.1.next , %loop ]
284
+ %iv.2 = phi i64 [ 600 , %entry ], [ %iv.2.next , %loop ]
285
+ %gep.mul.2 = getelementptr inbounds i32 , ptr %A , i64 %iv.1
286
+ %l = load i32 , ptr %gep.mul.2 , align 4
287
+ %add = add nsw i32 %l , 5
288
+ %gep = getelementptr inbounds i32 , ptr %A , i64 %iv.2
289
+ store i32 %add , ptr %gep , align 4
290
+ %iv.1.next = add nuw nsw i64 %iv.1 , 1
291
+ %iv.2.next = add nsw i64 %iv.2 , -2
292
+ %exitcond.not = icmp eq i64 %iv.1.next , 256
293
+ br i1 %exitcond.not , label %exit , label %loop
294
+
295
+ exit:
296
+ ret void
297
+ }
298
+
299
+ define void @strides_with_different_directions_4 (ptr %A ) {
300
+ ; CHECK-LABEL: 'strides_with_different_directions_4'
301
+ ; CHECK-NEXT: loop:
302
+ ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
303
+ ; CHECK-NEXT: Unknown data dependence.
304
+ ; CHECK-NEXT: Dependences:
305
+ ; CHECK-NEXT: Unknown:
306
+ ; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->
307
+ ; CHECK-NEXT: store i32 %add, ptr %gep, align 4
308
+ ; CHECK-EMPTY:
309
+ ; CHECK-NEXT: Run-time memory checks:
310
+ ; CHECK-NEXT: Grouped accesses:
311
+ ; CHECK-EMPTY:
312
+ ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
313
+ ; CHECK-NEXT: SCEV assumptions:
314
+ ; CHECK-EMPTY:
315
+ ; CHECK-NEXT: Expressions re-written:
316
+ ;
317
+ entry:
318
+ br label %loop
319
+
320
+ loop:
321
+ %iv.1 = phi i64 [ 0 , %entry ], [ %iv.1.next , %loop ]
322
+ %iv.2 = phi i64 [ 600 , %entry ], [ %iv.2.next , %loop ]
323
+ %gep.mul.2 = getelementptr inbounds i32 , ptr %A , i64 %iv.2
324
+ %l = load i32 , ptr %gep.mul.2 , align 4
325
+ %add = add nsw i32 %l , 5
326
+ %gep = getelementptr inbounds i32 , ptr %A , i64 %iv.1
327
+ store i32 %add , ptr %gep , align 4
328
+ %iv.1.next = add nuw nsw i64 %iv.1 , 1
329
+ %iv.2.next = add nsw i64 %iv.2 , -2
330
+ %exitcond.not = icmp eq i64 %iv.1.next , 256
331
+ br i1 %exitcond.not , label %exit , label %loop
332
+
333
+ exit:
334
+ ret void
335
+ }
336
+
337
+ define void @non_constant_strides_with_different_directions_1 (ptr %A ) {
338
+ ; CHECK-LABEL: 'non_constant_strides_with_different_directions_1'
339
+ ; CHECK-NEXT: loop:
340
+ ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
341
+ ; CHECK-NEXT: Unknown data dependence.
342
+ ; CHECK-NEXT: Dependences:
343
+ ; CHECK-NEXT: Unknown:
344
+ ; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->
345
+ ; CHECK-NEXT: store i32 %add, ptr %gep, align 4
346
+ ; CHECK-EMPTY:
347
+ ; CHECK-NEXT: Run-time memory checks:
348
+ ; CHECK-NEXT: Grouped accesses:
349
+ ; CHECK-EMPTY:
350
+ ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
351
+ ; CHECK-NEXT: SCEV assumptions:
352
+ ; CHECK-EMPTY:
353
+ ; CHECK-NEXT: Expressions re-written:
354
+ ;
355
+ entry:
356
+ br label %loop
357
+
358
+ loop:
359
+ %iv.1 = phi i64 [ 0 , %entry ], [ %iv.1.next , %loop ]
360
+ %iv.2 = phi i64 [ 300 , %entry ], [ %iv.2.next , %loop ]
361
+ %iv.mul.2 = shl nuw nsw i64 %iv.1 , 1
362
+ %gep.mul.2 = getelementptr inbounds i32 , ptr %A , i64 %iv.mul.2
363
+ %l = load i32 , ptr %gep.mul.2 , align 4
364
+ %add = add nsw i32 %l , 5
365
+ %gep = getelementptr inbounds i32 , ptr %A , i64 %iv.2
366
+ store i32 %add , ptr %gep , align 4
367
+ %iv.1.next = add nuw nsw i64 %iv.1 , 1
368
+ %iv.2.next = add nsw i64 %iv.2 , -1
369
+ %exitcond.not = icmp eq i64 %iv.1.next , 256
370
+ br i1 %exitcond.not , label %exit , label %loop
371
+
372
+ exit:
373
+ ret void
374
+ }
375
+
376
+ define void @non_constant_strides_with_different_directions_2 (ptr %A ) {
377
+ ; CHECK-LABEL: 'non_constant_strides_with_different_directions_2'
378
+ ; CHECK-NEXT: loop:
379
+ ; CHECK-NEXT: Report: unsafe dependent memory operations in loop. Use #pragma clang loop distribute(enable) to allow loop distribution to attempt to isolate the offending operations into a separate loop
380
+ ; CHECK-NEXT: Unknown data dependence.
381
+ ; CHECK-NEXT: Dependences:
382
+ ; CHECK-NEXT: Unknown:
383
+ ; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->
384
+ ; CHECK-NEXT: store i32 %add, ptr %gep, align 4
385
+ ; CHECK-EMPTY:
386
+ ; CHECK-NEXT: Run-time memory checks:
387
+ ; CHECK-NEXT: Grouped accesses:
388
+ ; CHECK-EMPTY:
389
+ ; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
390
+ ; CHECK-NEXT: SCEV assumptions:
391
+ ; CHECK-EMPTY:
392
+ ; CHECK-NEXT: Expressions re-written:
393
+ ;
394
+ entry:
395
+ br label %loop
396
+
397
+ loop:
398
+ %iv.1 = phi i64 [ 0 , %entry ], [ %iv.1.next , %loop ]
399
+ %iv.2 = phi i64 [ 300 , %entry ], [ %iv.2.next , %loop ]
400
+ %iv.mul.2 = shl nuw nsw i64 %iv.2 , 1
401
+ %gep.mul.2 = getelementptr inbounds i32 , ptr %A , i64 %iv.mul.2
402
+ %l = load i32 , ptr %gep.mul.2 , align 4
403
+ %add = add nsw i32 %l , 5
404
+ %gep = getelementptr inbounds i32 , ptr %A , i64 %iv.1
405
+ store i32 %add , ptr %gep , align 4
406
+ %iv.1.next = add nuw nsw i64 %iv.1 , 1
407
+ %iv.2.next = add nsw i64 %iv.2 , -1
408
+ %exitcond.not = icmp eq i64 %iv.1.next , 256
409
+ br i1 %exitcond.not , label %exit , label %loop
410
+
411
+ exit:
412
+ ret void
413
+ }
0 commit comments