Skip to content

Commit 85dbf2f

Browse files
fhahnyuxuanchen1997
authored andcommitted
[LAA] Adjust test from a4f8705 so RT checks aren't always false.
Summary: Updated @B_indices_loaded_in_loop_A_stored to use a different offset for one of the accesses we create runtime checks for; the original version had a runtime check that was always true as the accesses always overlapped. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251566
1 parent 7e406ce commit 85dbf2f

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

llvm/test/Analysis/LoopAccessAnalysis/load-store-index-loaded-in-loop.ll

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66
; same indices could be loaded in later iterations.
77
; FIXME: currently this is incorrectly considered safe for vectorization with
88
; runtime checks
9-
define void @B_indices_loaded_in_loop_A_stored(ptr %A, ptr noalias %B, i64 %N) {
9+
define void @B_indices_loaded_in_loop_A_stored(ptr %A, ptr noalias %B, i64 %N, i64 %off) {
1010
; CHECK-LABEL: 'B_indices_loaded_in_loop_A_stored'
1111
; CHECK-NEXT: loop:
1212
; CHECK-NEXT: Memory dependences are safe with run-time checks
1313
; CHECK-NEXT: Dependences:
1414
; CHECK-NEXT: Run-time memory checks:
1515
; CHECK-NEXT: Check 0:
1616
; CHECK-NEXT: Comparing group ([[GRP1:0x[0-9a-f]+]]):
17-
; CHECK-NEXT: %gep.A.1 = getelementptr inbounds i32, ptr %A, i64 %iv
17+
; CHECK-NEXT: %gep.C = getelementptr inbounds i32, ptr %A, i64 %iv
1818
; CHECK-NEXT: Against group ([[GRP2:0x[0-9a-f]+]]):
19-
; CHECK-NEXT: %gep.A.0 = getelementptr inbounds i8, ptr %A, i64 %iv
19+
; CHECK-NEXT: %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv.off
2020
; CHECK-NEXT: Grouped accesses:
2121
; CHECK-NEXT: Group [[GRP1]]:
2222
; CHECK-NEXT: (Low: %A High: ((4 * %N) + %A))
2323
; CHECK-NEXT: Member: {%A,+,4}<nuw><%loop>
2424
; CHECK-NEXT: Group [[GRP2]]:
25-
; CHECK-NEXT: (Low: %A High: (%N + %A))
26-
; CHECK-NEXT: Member: {%A,+,1}<nuw><%loop>
25+
; CHECK-NEXT: (Low: (%off + %A) High: (%N + %off + %A))
26+
; CHECK-NEXT: Member: {(%off + %A),+,1}<nw><%loop>
2727
; CHECK-EMPTY:
2828
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
2929
; CHECK-NEXT: SCEV assumptions:
@@ -35,15 +35,16 @@ entry:
3535

3636
loop:
3737
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
38-
%gep.A.0 = getelementptr inbounds i8, ptr %A, i64 %iv
39-
%indices = load i8, ptr %gep.A.0, align 1
38+
%iv.off = add nuw nsw i64 %iv, %off
39+
%gep.A = getelementptr inbounds i8, ptr %A, i64 %iv.off
40+
%indices = load i8, ptr %gep.A, align 1
4041
%indices.ext = zext i8 %indices to i64
4142
%gep.B = getelementptr inbounds i32, ptr %B, i64 %indices.ext
4243
%l = load i32, ptr %gep.B, align 4
4344
%inc = add i32 %l, 1
4445
store i32 %inc, ptr %gep.B, align 4
45-
%gep.A.1 = getelementptr inbounds i32, ptr %A, i64 %iv
46-
store i32 %l, ptr %gep.A.1, align 4
46+
%gep.C = getelementptr inbounds i32, ptr %A, i64 %iv
47+
store i32 %l, ptr %gep.C, align 4
4748
%iv.next = add nuw nsw i64 %iv, 1
4849
%ec = icmp eq i64 %iv.next, %N
4950
br i1 %ec, label %exit, label %loop
@@ -77,8 +78,8 @@ entry:
7778

7879
loop:
7980
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
80-
%gep.A.0 = getelementptr inbounds i8, ptr %A, i64 %iv
81-
%indices = load i8, ptr %gep.A.0, align 1
81+
%gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
82+
%indices = load i8, ptr %gep.A, align 1
8283
%indices.ext = zext i8 %indices to i64
8384
%gep.B = getelementptr inbounds i32, ptr %B, i64 %indices.ext
8485
%l = load i32, ptr %gep.B, align 4

0 commit comments

Comments
 (0)