Skip to content

Commit 7b6d6b9

Browse files
committed
!fixup clear dependencies after no longer needed
1 parent 46e99a2 commit 7b6d6b9

14 files changed

+10
-188
lines changed

llvm/lib/Analysis/LoopAccessAnalysis.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,12 @@ class AccessAnalysis {
841841
/// dependency checking (i.e. ShouldRetryWithRuntimeChecks).
842842
bool isDependencyCheckNeeded() const { return !CheckDeps.empty(); }
843843

844+
/// We decided that no dependence analysis would be used. Reset the state.
845+
void resetDepChecks(MemoryDepChecker &DepChecker) {
846+
CheckDeps.clear();
847+
DepChecker.clearDependences();
848+
}
849+
844850
const MemAccessInfoList &getDependenciesToCheck() const { return CheckDeps; }
845851

846852
private:
@@ -2769,6 +2775,10 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, const LoopInfo *LI,
27692775
LLVM_DEBUG(dbgs() << "LAA: Can't vectorize with memory checks\n");
27702776
return false;
27712777
}
2778+
2779+
// Clear the dependency checks. They are no longer needed.
2780+
Accesses.resetDepChecks(*DepChecker);
2781+
27722782
DepsAreSafe = true;
27732783
}
27742784
}

llvm/test/Analysis/LoopAccessAnalysis/accesses-completely-before-or-after.ll

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,6 @@ define i32 @may_overlap_true_dep_different_size(ptr %d) {
3737
; CHECK-NEXT: loop:
3838
; CHECK-NEXT: Memory dependences are safe with run-time checks
3939
; CHECK-NEXT: Dependences:
40-
; CHECK-NEXT: Unknown:
41-
; CHECK-NEXT: store i64 0, ptr %gep.128.iv, align 8 ->
42-
; CHECK-NEXT: %l = load i32, ptr %gep.iv, align 4
43-
; CHECK-EMPTY:
4440
; CHECK-NEXT: Run-time memory checks:
4541
; CHECK-NEXT: Check 0:
4642
; CHECK-NEXT: Comparing group GRP0:
@@ -115,10 +111,6 @@ define void @may_overlap_stores_with_different_sizes(ptr %dst) {
115111
; CHECK-NEXT: loop:
116112
; CHECK-NEXT: Memory dependences are safe with run-time checks
117113
; CHECK-NEXT: Dependences:
118-
; CHECK-NEXT: Unknown:
119-
; CHECK-NEXT: store i16 0, ptr %gep.iv, align 2 ->
120-
; CHECK-NEXT: store i8 0, ptr %gep.dst.128.iv, align 1
121-
; CHECK-EMPTY:
122114
; CHECK-NEXT: Run-time memory checks:
123115
; CHECK-NEXT: Check 0:
124116
; CHECK-NEXT: Comparing group GRP0:

llvm/test/Analysis/LoopAccessAnalysis/different-access-types-rt-checks.ll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,6 @@ define void @loads_of_same_pointer_with_different_sizes_retry_with_runtime_check
104104
; CHECK-NEXT: loop:
105105
; CHECK-NEXT: Memory dependences are safe with run-time checks
106106
; CHECK-NEXT: Dependences:
107-
; CHECK-NEXT: Unknown:
108-
; CHECK-NEXT: store i32 %sub.0, ptr %gep.B.iv, align 4 ->
109-
; CHECK-NEXT: store i32 %sub.1, ptr %gep.B.inc, align 4
110-
; CHECK-EMPTY:
111107
; CHECK-NEXT: Run-time memory checks:
112108
; CHECK-NEXT: Check 0:
113109
; CHECK-NEXT: Comparing group GRP0:

llvm/test/Analysis/LoopAccessAnalysis/loops-with-indirect-reads-and-writes.ll

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ define void @test_indirect_read_loop_also_modifies_pointer_array(ptr noundef %ar
9090
; CHECK-NEXT: loop.2:
9191
; CHECK-NEXT: Memory dependences are safe with run-time checks
9292
; CHECK-NEXT: Dependences:
93-
; CHECK-NEXT: Unknown:
94-
; CHECK-NEXT: %l.1 = load ptr, ptr %gep.iv.1, align 8, !tbaa !0 ->
95-
; CHECK-NEXT: store i64 %l.2, ptr %gep.iv.2, align 8, !tbaa !0
96-
; CHECK-EMPTY:
9793
; CHECK-NEXT: Run-time memory checks:
9894
; CHECK-NEXT: Check 0:
9995
; CHECK-NEXT: Comparing group GRP0:
@@ -162,10 +158,6 @@ define void @test_indirect_write_loop_also_modifies_pointer_array(ptr noundef %a
162158
; CHECK-NEXT: loop.2:
163159
; CHECK-NEXT: Memory dependences are safe with run-time checks
164160
; CHECK-NEXT: Dependences:
165-
; CHECK-NEXT: Unknown:
166-
; CHECK-NEXT: %l.1 = load ptr, ptr %gep.iv.1, align 8, !tbaa !0 ->
167-
; CHECK-NEXT: store ptr %l.1, ptr %gep.iv.2, align 8, !tbaa !0
168-
; CHECK-EMPTY:
169161
; CHECK-NEXT: Run-time memory checks:
170162
; CHECK-NEXT: Check 0:
171163
; CHECK-NEXT: Comparing group GRP0:

llvm/test/Analysis/LoopAccessAnalysis/multiple-strides-rt-memory-checks.ll

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,6 @@ define void @Test(ptr nocapture %obj, i64 %z) #0 {
3131
; CHECK-NEXT: .inner:
3232
; CHECK-NEXT: Memory dependences are safe with a maximum safe vector width of 2048 bits with run-time checks
3333
; CHECK-NEXT: Dependences:
34-
; CHECK-NEXT: Unknown:
35-
; CHECK-NEXT: %4 = load i32, ptr %1, align 4 ->
36-
; CHECK-NEXT: store i32 %8, ptr %6, align 4
37-
; CHECK-EMPTY:
38-
; CHECK-NEXT: BackwardVectorizable:
39-
; CHECK-NEXT: %3 = load i32, ptr %2, align 4 ->
40-
; CHECK-NEXT: store i32 %8, ptr %6, align 4
41-
; CHECK-EMPTY:
42-
; CHECK-NEXT: Forward:
43-
; CHECK-NEXT: %7 = load i32, ptr %6, align 4 ->
44-
; CHECK-NEXT: store i32 %8, ptr %6, align 4
45-
; CHECK-EMPTY:
4634
; CHECK-NEXT: Run-time memory checks:
4735
; CHECK-NEXT: Check 0:
4836
; CHECK-NEXT: Comparing group GRP0:

llvm/test/Analysis/LoopAccessAnalysis/non-constant-distance-backward.ll

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ define void @backward_min_distance_8(ptr %A, i64 %N) {
1919
; COMMON-NEXT: loop:
2020
; COMMON-NEXT: Memory dependences are safe with run-time checks
2121
; COMMON-NEXT: Dependences:
22-
; COMMON-NEXT: Unknown:
23-
; COMMON-NEXT: %l = load i8, ptr %gep, align 4 ->
24-
; COMMON-NEXT: store i8 %add, ptr %gep.off.iv, align 4
25-
; COMMON-EMPTY:
2622
; COMMON-NEXT: Run-time memory checks:
2723
; COMMON-NEXT: Check 0:
2824
; COMMON-NEXT: Comparing group GRP0:
@@ -111,10 +107,6 @@ define void @backward_min_distance_120(ptr %A, i64 %N) {
111107
; VW128-NEXT: loop:
112108
; VW128-NEXT: Memory dependences are safe with run-time checks
113109
; VW128-NEXT: Dependences:
114-
; VW128-NEXT: Unknown:
115-
; VW128-NEXT: %l = load i8, ptr %gep, align 4 ->
116-
; VW128-NEXT: store i8 %add, ptr %gep.off.iv, align 4
117-
; VW128-EMPTY:
118110
; VW128-NEXT: Run-time memory checks:
119111
; VW128-NEXT: Check 0:
120112
; VW128-NEXT: Comparing group GRP0:
@@ -148,10 +140,6 @@ define void @backward_min_distance_120(ptr %A, i64 %N) {
148140
; MAXLEN-NEXT: loop:
149141
; MAXLEN-NEXT: Memory dependences are safe with run-time checks
150142
; MAXLEN-NEXT: Dependences:
151-
; MAXLEN-NEXT: Unknown:
152-
; MAXLEN-NEXT: %l = load i8, ptr %gep, align 4 ->
153-
; MAXLEN-NEXT: store i8 %add, ptr %gep.off.iv, align 4
154-
; MAXLEN-EMPTY:
155143
; MAXLEN-NEXT: Run-time memory checks:
156144
; MAXLEN-NEXT: Check 0:
157145
; MAXLEN-NEXT: Comparing group GRP0:
@@ -240,10 +228,6 @@ define void @backward_min_distance_128(ptr %A, i64 %N) {
240228
; VW128-NEXT: loop:
241229
; VW128-NEXT: Memory dependences are safe with run-time checks
242230
; VW128-NEXT: Dependences:
243-
; VW128-NEXT: Unknown:
244-
; VW128-NEXT: %l = load i8, ptr %gep, align 4 ->
245-
; VW128-NEXT: store i8 %add, ptr %gep.off.iv, align 4
246-
; VW128-EMPTY:
247231
; VW128-NEXT: Run-time memory checks:
248232
; VW128-NEXT: Check 0:
249233
; VW128-NEXT: Comparing group GRP0:
@@ -277,10 +261,6 @@ define void @backward_min_distance_128(ptr %A, i64 %N) {
277261
; MAXLEN-NEXT: loop:
278262
; MAXLEN-NEXT: Memory dependences are safe with run-time checks
279263
; MAXLEN-NEXT: Dependences:
280-
; MAXLEN-NEXT: Unknown:
281-
; MAXLEN-NEXT: %l = load i8, ptr %gep, align 4 ->
282-
; MAXLEN-NEXT: store i8 %add, ptr %gep.off.iv, align 4
283-
; MAXLEN-EMPTY:
284264
; MAXLEN-NEXT: Run-time memory checks:
285265
; MAXLEN-NEXT: Check 0:
286266
; MAXLEN-NEXT: Comparing group GRP0:
@@ -395,10 +375,6 @@ define void @backward_min_distance_256(ptr %A, i64 %N) {
395375
; MAXLEN-NEXT: loop:
396376
; MAXLEN-NEXT: Memory dependences are safe with run-time checks
397377
; MAXLEN-NEXT: Dependences:
398-
; MAXLEN-NEXT: Unknown:
399-
; MAXLEN-NEXT: %l = load i8, ptr %gep, align 4 ->
400-
; MAXLEN-NEXT: store i8 %add, ptr %gep.off.iv, align 4
401-
; MAXLEN-EMPTY:
402378
; MAXLEN-NEXT: Run-time memory checks:
403379
; MAXLEN-NEXT: Check 0:
404380
; MAXLEN-NEXT: Comparing group GRP0:

llvm/test/Analysis/LoopAccessAnalysis/offset-range-known-via-assume.ll

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ define void @offset_i32_known_positive_via_assume_forward_dep_1(ptr %A, i64 %off
5353
; CHECK-NEXT: loop:
5454
; CHECK-NEXT: Memory dependences are safe with run-time checks
5555
; CHECK-NEXT: Dependences:
56-
; CHECK-NEXT: Unknown:
57-
; CHECK-NEXT: %l = load i8, ptr %gep.off, align 4 ->
58-
; CHECK-NEXT: store i8 %add, ptr %gep, align 4
59-
; CHECK-EMPTY:
6056
; CHECK-NEXT: Run-time memory checks:
6157
; CHECK-NEXT: Check 0:
6258
; CHECK-NEXT: Comparing group GRP0:
@@ -147,10 +143,6 @@ define void @offset_may_be_negative_via_assume_unknown_dep(ptr %A, i64 %offset,
147143
; CHECK-NEXT: loop:
148144
; CHECK-NEXT: Memory dependences are safe with run-time checks
149145
; CHECK-NEXT: Dependences:
150-
; CHECK-NEXT: Unknown:
151-
; CHECK-NEXT: %l = load i32, ptr %gep, align 4 ->
152-
; CHECK-NEXT: store i32 %add, ptr %gep.mul.2, align 4
153-
; CHECK-EMPTY:
154146
; CHECK-NEXT: Run-time memory checks:
155147
; CHECK-NEXT: Check 0:
156148
; CHECK-NEXT: Comparing group GRP0:
@@ -198,10 +190,6 @@ define void @offset_no_assumes(ptr %A, i64 %offset, i64 %N) {
198190
; CHECK-NEXT: loop:
199191
; CHECK-NEXT: Memory dependences are safe with run-time checks
200192
; CHECK-NEXT: Dependences:
201-
; CHECK-NEXT: Unknown:
202-
; CHECK-NEXT: %l = load i32, ptr %gep.off, align 4 ->
203-
; CHECK-NEXT: store i32 %add, ptr %gep, align 4
204-
; CHECK-EMPTY:
205193
; CHECK-NEXT: Run-time memory checks:
206194
; CHECK-NEXT: Check 0:
207195
; CHECK-NEXT: Comparing group GRP0:

llvm/test/Analysis/LoopAccessAnalysis/positive-dependence-distance-different-access-sizes.ll

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ define void @test_distance_positive_backwards(ptr %A) {
4444
; CHECK-NEXT: loop:
4545
; CHECK-NEXT: Memory dependences are safe with run-time checks
4646
; CHECK-NEXT: Dependences:
47-
; CHECK-NEXT: Unknown:
48-
; CHECK-NEXT: %l = load i8, ptr %gep.A, align 1 ->
49-
; CHECK-NEXT: store i32 %ext, ptr %gep.A.400, align 4
50-
; CHECK-EMPTY:
5147
; CHECK-NEXT: Run-time memory checks:
5248
; CHECK-NEXT: Check 0:
5349
; CHECK-NEXT: Comparing group GRP0:
@@ -91,10 +87,6 @@ define void @test_distance_positive_via_assume(ptr %A, i64 %off) {
9187
; CHECK-NEXT: loop:
9288
; CHECK-NEXT: Memory dependences are safe with run-time checks
9389
; CHECK-NEXT: Dependences:
94-
; CHECK-NEXT: Unknown:
95-
; CHECK-NEXT: %l = load i8, ptr %gep.A, align 1 ->
96-
; CHECK-NEXT: store i32 %ext, ptr %gep.A.400, align 4
97-
; CHECK-EMPTY:
9890
; CHECK-NEXT: Run-time memory checks:
9991
; CHECK-NEXT: Check 0:
10092
; CHECK-NEXT: Comparing group GRP0:

llvm/test/Analysis/LoopAccessAnalysis/resort-to-memchecks-only.ll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ target triple = "x86_64-apple-macosx10.10.0"
1313

1414
; CHECK: Memory dependences are safe with run-time checks
1515
; CHECK-NEXT: Dependences:
16-
; CHECK-NEXT: Unknown:
17-
; CHECK-NEXT: %loadA = load i16, ptr %arrayidxA, align 2 ->
18-
; CHECK-NEXT: store i16 %mul1, ptr %arrayidxA2, align 2
19-
; CHECK-EMPTY:
2016
; CHECK-NEXT: Run-time memory checks:
2117
; CHECK-NEXT: 0:
2218
; CHECK-NEXT: Comparing group

llvm/test/Analysis/LoopAccessAnalysis/retry-runtime-checks-after-dependence-analysis-forked-pointers.ll

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ define void @dependency_check_and_runtime_checks_needed_select_of_invariant_ptrs
77
; CHECK-NEXT: loop:
88
; CHECK-NEXT: Memory dependences are safe with run-time checks
99
; CHECK-NEXT: Dependences:
10-
; CHECK-NEXT: Unknown:
11-
; CHECK-NEXT: %l2 = load float, ptr %gep.a.iv.off, align 4 ->
12-
; CHECK-NEXT: store float %ad, ptr %gep.a.iv, align 4
13-
; CHECK-EMPTY:
14-
; CHECK-NEXT: Forward:
15-
; CHECK-NEXT: %l1 = load float, ptr %gep.a.iv, align 4 ->
16-
; CHECK-NEXT: store float %ad, ptr %gep.a.iv, align 4
17-
; CHECK-EMPTY:
1810
; CHECK-NEXT: Run-time memory checks:
1911
; CHECK-NEXT: Check 0:
2012
; CHECK-NEXT: Comparing group GRP0:
@@ -88,14 +80,6 @@ define void @dependency_check_and_runtime_checks_needed_select_of_ptr_add_recs(p
8880
; CHECK-NEXT: loop:
8981
; CHECK-NEXT: Memory dependences are safe with run-time checks
9082
; CHECK-NEXT: Dependences:
91-
; CHECK-NEXT: Unknown:
92-
; CHECK-NEXT: %l2 = load float, ptr %gep.a.iv.off, align 4 ->
93-
; CHECK-NEXT: store float %ad, ptr %gep.a.iv, align 4
94-
; CHECK-EMPTY:
95-
; CHECK-NEXT: Forward:
96-
; CHECK-NEXT: %l1 = load float, ptr %gep.a.iv, align 4 ->
97-
; CHECK-NEXT: store float %ad, ptr %gep.a.iv, align 4
98-
; CHECK-EMPTY:
9983
; CHECK-NEXT: Run-time memory checks:
10084
; CHECK-NEXT: Check 0:
10185
; CHECK-NEXT: Comparing group GRP0:

0 commit comments

Comments
 (0)