[LAA] Adjust test from a4f8705b05 so RT checks aren't always false.

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.
This commit is contained in:
Florian Hahn
2024-07-16 21:56:55 +01:00
parent 9be5f4f5d5
commit 4199f80df5

View File

@@ -6,7 +6,7 @@
; same indices could be loaded in later iterations.
; FIXME: currently this is incorrectly considered safe for vectorization with
; runtime checks
define void @B_indices_loaded_in_loop_A_stored(ptr %A, ptr noalias %B, i64 %N) {
define void @B_indices_loaded_in_loop_A_stored(ptr %A, ptr noalias %B, i64 %N, i64 %off) {
; CHECK-LABEL: 'B_indices_loaded_in_loop_A_stored'
; CHECK-NEXT: loop:
; CHECK-NEXT: Memory dependences are safe with run-time checks
@@ -14,16 +14,16 @@ define void @B_indices_loaded_in_loop_A_stored(ptr %A, ptr noalias %B, i64 %N) {
; CHECK-NEXT: Run-time memory checks:
; CHECK-NEXT: Check 0:
; CHECK-NEXT: Comparing group ([[GRP1:0x[0-9a-f]+]]):
; CHECK-NEXT: %gep.A.1 = getelementptr inbounds i32, ptr %A, i64 %iv
; CHECK-NEXT: %gep.C = getelementptr inbounds i32, ptr %A, i64 %iv
; CHECK-NEXT: Against group ([[GRP2:0x[0-9a-f]+]]):
; CHECK-NEXT: %gep.A.0 = getelementptr inbounds i8, ptr %A, i64 %iv
; CHECK-NEXT: %gep.A = getelementptr inbounds i8, ptr %A, i64 %iv.off
; CHECK-NEXT: Grouped accesses:
; CHECK-NEXT: Group [[GRP1]]:
; CHECK-NEXT: (Low: %A High: ((4 * %N) + %A))
; CHECK-NEXT: Member: {%A,+,4}<nuw><%loop>
; CHECK-NEXT: Group [[GRP2]]:
; CHECK-NEXT: (Low: %A High: (%N + %A))
; CHECK-NEXT: Member: {%A,+,1}<nuw><%loop>
; CHECK-NEXT: (Low: (%off + %A) High: (%N + %off + %A))
; CHECK-NEXT: Member: {(%off + %A),+,1}<nw><%loop>
; CHECK-EMPTY:
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
; CHECK-NEXT: SCEV assumptions:
@@ -35,15 +35,16 @@ entry:
loop:
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
%gep.A.0 = getelementptr inbounds i8, ptr %A, i64 %iv
%indices = load i8, ptr %gep.A.0, align 1
%iv.off = add nuw nsw i64 %iv, %off
%gep.A = getelementptr inbounds i8, ptr %A, i64 %iv.off
%indices = load i8, ptr %gep.A, align 1
%indices.ext = zext i8 %indices to i64
%gep.B = getelementptr inbounds i32, ptr %B, i64 %indices.ext
%l = load i32, ptr %gep.B, align 4
%inc = add i32 %l, 1
store i32 %inc, ptr %gep.B, align 4
%gep.A.1 = getelementptr inbounds i32, ptr %A, i64 %iv
store i32 %l, ptr %gep.A.1, align 4
%gep.C = getelementptr inbounds i32, ptr %A, i64 %iv
store i32 %l, ptr %gep.C, align 4
%iv.next = add nuw nsw i64 %iv, 1
%ec = icmp eq i64 %iv.next, %N
br i1 %ec, label %exit, label %loop
@@ -77,8 +78,8 @@ entry:
loop:
%iv = phi i64 [ 0, %entry ], [ %iv.next, %loop ]
%gep.A.0 = getelementptr inbounds i8, ptr %A, i64 %iv
%indices = load i8, ptr %gep.A.0, align 1
%gep.A = getelementptr inbounds i8, ptr %A, i64 %iv
%indices = load i8, ptr %gep.A, align 1
%indices.ext = zext i8 %indices to i64
%gep.B = getelementptr inbounds i32, ptr %B, i64 %indices.ext
%l = load i32, ptr %gep.B, align 4