Skip to content

Commit d5f2753

Browse files
committed
[LAA] Tests with different strides where BTC can rule out dependence.
Tests to add support for different strides with isSafeDependenceDistance as follow-up to #88039.
1 parent 87ec4ab commit d5f2753

File tree

1 file changed

+156
-0
lines changed

1 file changed

+156
-0
lines changed
Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
2+
; RUN: opt -passes='print<access-info>' -disable-output %s 2>&1 | FileCheck %s
3+
4+
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
5+
6+
define void @forward_dep_known_safe_due_to_backedge_taken_count(ptr %A) {
7+
; CHECK-LABEL: 'forward_dep_known_safe_due_to_backedge_taken_count'
8+
; CHECK-NEXT: loop:
9+
; 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
10+
; CHECK-NEXT: Unknown data dependence.
11+
; CHECK-NEXT: Dependences:
12+
; CHECK-NEXT: Unknown:
13+
; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->
14+
; CHECK-NEXT: store i32 %add, ptr %gep, align 4
15+
; CHECK-EMPTY:
16+
; CHECK-NEXT: Run-time memory checks:
17+
; CHECK-NEXT: Grouped accesses:
18+
; CHECK-EMPTY:
19+
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
20+
; CHECK-NEXT: SCEV assumptions:
21+
; CHECK-EMPTY:
22+
; CHECK-NEXT: Expressions re-written:
23+
;
24+
entry:
25+
%A.511= getelementptr inbounds i32, ptr %A, i64 511
26+
br label %loop
27+
28+
loop:
29+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
30+
%iv.mul.2 = shl nuw nsw i64 %iv, 1
31+
%gep.mul.2 = getelementptr inbounds i32, ptr %A.511, i64 %iv.mul.2
32+
%l = load i32, ptr %gep.mul.2, align 4
33+
%add = add nsw i32 %l, 5
34+
%gep = getelementptr inbounds i32, ptr %A, i64 %iv
35+
store i32 %add, ptr %gep, align 4
36+
%iv.next = add nuw nsw i64 %iv, 1
37+
%exitcond.not = icmp eq i64 %iv.next, 256
38+
br i1 %exitcond.not, label %exit, label %loop
39+
40+
exit:
41+
ret void
42+
}
43+
44+
define void @forward_dep_not_known_safe_due_to_backedge_taken_count(ptr %A) {
45+
; CHECK-LABEL: 'forward_dep_not_known_safe_due_to_backedge_taken_count'
46+
; CHECK-NEXT: loop:
47+
; 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
48+
; CHECK-NEXT: Unknown data dependence.
49+
; CHECK-NEXT: Dependences:
50+
; CHECK-NEXT: Unknown:
51+
; CHECK-NEXT: %l = load i32, ptr %gep.mul.2, align 4 ->
52+
; CHECK-NEXT: store i32 %add, ptr %gep, align 4
53+
; CHECK-EMPTY:
54+
; CHECK-NEXT: Run-time memory checks:
55+
; CHECK-NEXT: Grouped accesses:
56+
; CHECK-EMPTY:
57+
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
58+
; CHECK-NEXT: SCEV assumptions:
59+
; CHECK-EMPTY:
60+
; CHECK-NEXT: Expressions re-written:
61+
;
62+
entry:
63+
%A.510 = getelementptr inbounds i32, ptr %A, i64 510
64+
br label %loop
65+
66+
loop:
67+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
68+
%iv.mul.2 = shl nuw nsw i64 %iv, 1
69+
%gep.mul.2 = getelementptr inbounds i32, ptr %A.510, i64 %iv.mul.2
70+
%l = load i32, ptr %gep.mul.2, align 4
71+
%add = add nsw i32 %l, 5
72+
%gep = getelementptr inbounds i32, ptr %A, i64 %iv
73+
store i32 %add, ptr %gep, align 4
74+
%iv.next = add nuw nsw i64 %iv, 1
75+
%exitcond.not = icmp eq i64 %iv.next, 256
76+
br i1 %exitcond.not, label %exit, label %loop
77+
78+
exit:
79+
ret void
80+
}
81+
82+
define void @unknown_dep_known_safe_due_to_backedge_taken_count(ptr %A) {
83+
; CHECK-LABEL: 'unknown_dep_known_safe_due_to_backedge_taken_count'
84+
; CHECK-NEXT: loop:
85+
; 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
86+
; CHECK-NEXT: Unknown data dependence.
87+
; CHECK-NEXT: Dependences:
88+
; CHECK-NEXT: Unknown:
89+
; CHECK-NEXT: %l = load i32, ptr %gep, align 4 ->
90+
; CHECK-NEXT: store i32 %add, ptr %gep.mul.2, align 4
91+
; CHECK-EMPTY:
92+
; CHECK-NEXT: Run-time memory checks:
93+
; CHECK-NEXT: Grouped accesses:
94+
; CHECK-EMPTY:
95+
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
96+
; CHECK-NEXT: SCEV assumptions:
97+
; CHECK-EMPTY:
98+
; CHECK-NEXT: Expressions re-written:
99+
;
100+
entry:
101+
%A.511 = getelementptr inbounds i32, ptr %A, i64 511
102+
br label %loop
103+
104+
loop:
105+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
106+
%iv.mul.2 = shl nuw nsw i64 %iv, 1
107+
%gep = getelementptr inbounds i32, ptr %A, i64 %iv
108+
%l = load i32, ptr %gep, align 4
109+
%add = add nsw i32 %l, 5
110+
%gep.mul.2 = getelementptr inbounds i32, ptr %A.511, i64 %iv.mul.2
111+
store i32 %add, ptr %gep.mul.2, align 4
112+
%iv.next = add nuw nsw i64 %iv, 1
113+
%exitcond.not = icmp eq i64 %iv.next, 256
114+
br i1 %exitcond.not, label %exit, label %loop
115+
116+
exit:
117+
ret void
118+
}
119+
120+
define void @unknown_dep_not_known_safe_due_to_backedge_taken_count(ptr %A) {
121+
; CHECK-LABEL: 'unknown_dep_not_known_safe_due_to_backedge_taken_count'
122+
; CHECK-NEXT: loop:
123+
; 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
124+
; CHECK-NEXT: Unknown data dependence.
125+
; CHECK-NEXT: Dependences:
126+
; CHECK-NEXT: Unknown:
127+
; CHECK-NEXT: %l = load i32, ptr %gep, align 4 ->
128+
; CHECK-NEXT: store i32 %add, ptr %gep.mul.2, align 4
129+
; CHECK-EMPTY:
130+
; CHECK-NEXT: Run-time memory checks:
131+
; CHECK-NEXT: Grouped accesses:
132+
; CHECK-EMPTY:
133+
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
134+
; CHECK-NEXT: SCEV assumptions:
135+
; CHECK-EMPTY:
136+
; CHECK-NEXT: Expressions re-written:
137+
;
138+
entry:
139+
%A.510 = getelementptr inbounds i32, ptr %A, i64 510
140+
br label %loop
141+
142+
loop:
143+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
144+
%iv.mul.2 = shl nuw nsw i64 %iv, 1
145+
%gep = getelementptr inbounds i32, ptr %A, i64 %iv
146+
%l = load i32, ptr %gep, align 4
147+
%add = add nsw i32 %l, 5
148+
%gep.mul.2 = getelementptr inbounds i32, ptr %A.510, i64 %iv.mul.2
149+
store i32 %add, ptr %gep.mul.2, align 4
150+
%iv.next = add nuw nsw i64 %iv, 1
151+
%exitcond.not = icmp eq i64 %iv.next, 256
152+
br i1 %exitcond.not, label %exit, label %loop
153+
154+
exit:
155+
ret void
156+
}

0 commit comments

Comments
 (0)