forked from llvm/llvm-project
- Notifications
You must be signed in to change notification settings - Fork 339
/
Copy pathforward-negative-step.ll
82 lines (74 loc) · 2.87 KB
/
forward-negative-step.ll
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
; RUN: opt -passes='print<access-info>' -disable-output < %s 2>&1 | FileCheck %s
targetdatalayout = "e-m:e-i64:64-i128:128-n32:64-S128"
; void vectorizable_Read_Write(int *A) {
; for (unsigned i = 1022; i >= 0; i--)
; A[i+1] = A[i] + 1;
; }
definevoid@vectorizable_Read_Write(ptrnocapture%A) {
; CHECK-LABEL: 'vectorizable_Read_Write'
; CHECK-NEXT: loop:
; CHECK-NEXT: Memory dependences are safe
; CHECK-NEXT: Dependences:
; CHECK-NEXT: Forward:
; CHECK-NEXT: %l = load i32, ptr %gep.A, align 4 ->
; CHECK-NEXT: store i32 %add, ptr %gep.A.plus.1, align 4
; CHECK-EMPTY:
; CHECK-NEXT: Run-time memory checks:
; CHECK-NEXT: Grouped accesses:
; CHECK-EMPTY:
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
; CHECK-NEXT: SCEV assumptions:
; CHECK-EMPTY:
; CHECK-NEXT: Expressions re-written:
;
entry:
%A.plus.1 = getelementptri32, ptr%A, i641
brlabel%loop
loop:
%iv = phii64 [ 1022, %entry ], [ %iv.next, %loop ]
%gep.A = getelementptrinboundsi32, ptr%A, i64%iv
%l = loadi32, ptr%gep.A, align4
%add = addnswi32%l, 1
%gep.A.plus.1 = getelementptri32, ptr%A.plus.1, i64%iv
storei32%add, ptr%gep.A.plus.1, align4
%iv.next = addnswi64%iv, -1
%cmp.not = icmpeqi64%iv, 0
bri1%cmp.not, label%exit, label%loop
exit:
retvoid
}
definevoid@neg_step_ForwardButPreventsForwarding(ptrnocapture%A, ptrnoalias%B) {
; CHECK-LABEL: 'neg_step_ForwardButPreventsForwarding'
; CHECK-NEXT: loop:
; 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
; CHECK-NEXT: Forward loop carried data dependence that prevents store-to-load forwarding.
; CHECK-NEXT: Dependences:
; CHECK-NEXT: ForwardButPreventsForwarding:
; CHECK-NEXT: store i32 0, ptr %gep.A, align 4 ->
; CHECK-NEXT: %l = load i32, ptr %gep.A.plus.1, align 4
; CHECK-EMPTY:
; CHECK-NEXT: Run-time memory checks:
; CHECK-NEXT: Grouped accesses:
; CHECK-EMPTY:
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
; CHECK-NEXT: SCEV assumptions:
; CHECK-EMPTY:
; CHECK-NEXT: Expressions re-written:
;
entry:
%A.plus.1 = getelementptri32, ptr%A, i641
brlabel%loop
loop:
%iv = phii64 [ 1022, %entry ], [ %iv.next, %loop ]
%gep.A = getelementptrinboundsi32, ptr%A, i64%iv
storei320, ptr%gep.A, align4
%gep.A.plus.1 = getelementptri32, ptr%A.plus.1, i64%iv
%l = loadi32, ptr%gep.A.plus.1, align4
storei32%l, ptr%B
%iv.next = addnswi64%iv, -1
%cmp.not = icmpeqi64%iv, 0
bri1%cmp.not, label%exit, label%loop
exit:
retvoid
}