Skip to content

Commit a11c5dd

Browse files
committed
[LAA] Add test variant with backward dep with overlap in loop.
The original test @backward_dep_known_distance_less_than_btc was incorrectly named, as all loads are completely before the first store. Add a variant where this is not the case: @backward_dep_known_distance_less_than_btc
1 parent fd8ae2c commit a11c5dd

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

llvm/test/Analysis/LoopAccessAnalysis/different-strides-safe-dep-due-to-backedge-taken-count.ll

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ exit:
106106
ret void
107107
}
108108

109-
define void @backward_dep_known_distance_less_than_btc(ptr %A) {
110-
; CHECK-LABEL: 'backward_dep_known_distance_less_than_btc'
109+
; TOOD: The loop should be safe without dependence, as all accesses to %l are
110+
; completely before the first store.
111+
define void @backward_dep_known_safe_due_to_backedge_taken_count(ptr %A) {
112+
; CHECK-LABEL: 'backward_dep_known_safe_due_to_backedge_taken_count'
111113
; CHECK-NEXT: loop:
112114
; CHECK-NEXT: Memory dependences are safe with a maximum safe vector width of 8160 bits
113115
; CHECK-NEXT: Dependences:
@@ -142,3 +144,40 @@ loop:
142144
exit:
143145
ret void
144146
}
147+
148+
define void @backward_dep_known_distance_less_than_btc(ptr %A) {
149+
; CHECK-LABEL: 'backward_dep_known_distance_less_than_btc'
150+
; CHECK-NEXT: loop:
151+
; CHECK-NEXT: Memory dependences are safe with a maximum safe vector width of 4064 bits
152+
; CHECK-NEXT: Dependences:
153+
; CHECK-NEXT: BackwardVectorizable:
154+
; CHECK-NEXT: %l = load i32, ptr %gep, align 4 ->
155+
; CHECK-NEXT: store i32 %add, ptr %gep.mul.2, align 4
156+
; CHECK-EMPTY:
157+
; CHECK-NEXT: Run-time memory checks:
158+
; CHECK-NEXT: Grouped accesses:
159+
; CHECK-EMPTY:
160+
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
161+
; CHECK-NEXT: SCEV assumptions:
162+
; CHECK-EMPTY:
163+
; CHECK-NEXT: Expressions re-written:
164+
;
165+
entry:
166+
%A.510 = getelementptr inbounds i32, ptr %A, i64 510
167+
br label %loop
168+
169+
loop:
170+
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
171+
%iv.mul.2 = shl nuw nsw i64 %iv, 1
172+
%gep = getelementptr inbounds i32, ptr %A, i64 %iv.mul.2
173+
%l = load i32, ptr %gep, align 4
174+
%add = add nsw i32 %l, 5
175+
%gep.mul.2 = getelementptr inbounds i32, ptr %A.510, i64 %iv
176+
store i32 %add, ptr %gep.mul.2, align 4
177+
%iv.next = add nuw nsw i64 %iv, 1
178+
%exitcond.not = icmp eq i64 %iv.next, 256
179+
br i1 %exitcond.not, label %exit, label %loop
180+
181+
exit:
182+
ret void
183+
}

0 commit comments

Comments
 (0)