[LAA] Add additional tests for #161445.

Add extra test variants for
https://github.com/llvm/llvm-project/pull/161445.
This commit is contained in:
Florian Hahn
2025-10-27 02:39:08 +00:00
parent 1fae9db3d5
commit 3cb8a52e2d

View File

@@ -54,6 +54,100 @@ exit:
ret void
}
; Same as @test_inbounds_gep_used_in_predicated_block, but also storing the
; pointer values in the header.
define void @test_inbounds_gep_used_in_predicated_block_stored_value_operand(ptr %A, i64 %n, ptr noalias %B) {
; CHECK-LABEL: 'test_inbounds_gep_used_in_predicated_block_stored_value_operand'
; CHECK-NEXT: loop.header:
; CHECK-NEXT: Memory dependences are safe
; CHECK-NEXT: Dependences:
; CHECK-NEXT: Run-time memory checks:
; CHECK-NEXT: Grouped accesses:
; CHECK-EMPTY:
; CHECK-NEXT: Non vectorizable stores to invariant address were found in loop.
; CHECK-NEXT: SCEV assumptions:
; CHECK-EMPTY:
; CHECK-NEXT: Expressions re-written:
;
entry:
br label %loop.header
loop.header:
%i = phi i64 [ 0, %entry ], [ %i.next, %loop.latch ]
%offset.0 = phi i64 [ 0, %entry ], [ %offset.0.next, %loop.latch ]
%offset.1 = phi i64 [ 0, %entry ], [ %offset.1.next, %loop.latch ]
%idx.0 = getelementptr inbounds i8, ptr %A, i64 %offset.0
%idx.1 = getelementptr inbounds i8, ptr %A, i64 %offset.1
%mask = and i64 %i, 3
%cond = icmp eq i64 %mask, 0
store ptr %idx.0, ptr %B
store ptr %idx.1, ptr %B
br i1 %cond, label %if.then, label %loop.latch
if.then:
store i8 2, ptr %idx.0
store i8 1, ptr %idx.1
br label %loop.latch
loop.latch:
%i.next = add nuw nsw i64 %i, 1
%offset.0.next = add i64 %offset.0, 4611686018427387905 ; 2^62 + 1
%offset.1.next = add i64 %offset.1, 4611686018427387906 ; 2^62 + 2
%cond.exit = icmp eq i64 %i.next, 100
br i1 %cond.exit, label %exit, label %loop.header
exit:
ret void
}
; Same as @test_inbounds_gep_used_in_predicated_block_non_memop_user, but with
; extra GEP users in the header.
define void @test_inbounds_gep_used_in_predicated_block_non_memop_user(ptr %A, i64 %n) {
; CHECK-LABEL: 'test_inbounds_gep_used_in_predicated_block_non_memop_user'
; CHECK-NEXT: loop.header:
; CHECK-NEXT: Memory dependences are safe
; CHECK-NEXT: Dependences:
; CHECK-NEXT: Run-time memory checks:
; CHECK-NEXT: Grouped accesses:
; CHECK-EMPTY:
; CHECK-NEXT: Non vectorizable stores to invariant address were not found in loop.
; CHECK-NEXT: SCEV assumptions:
; CHECK-EMPTY:
; CHECK-NEXT: Expressions re-written:
;
entry:
br label %loop.header
loop.header:
%i = phi i64 [ 0, %entry ], [ %i.next, %loop.latch ]
%offset.0 = phi i64 [ 0, %entry ], [ %offset.0.next, %loop.latch ]
%offset.1 = phi i64 [ 0, %entry ], [ %offset.1.next, %loop.latch ]
%idx.0 = getelementptr inbounds i8, ptr %A, i64 %offset.0
%idx.1 = getelementptr inbounds i8, ptr %A, i64 %offset.1
%mask = and i64 %i, 3
%cond = icmp eq i64 %mask, 0
%gep.idx.0 = getelementptr inbounds i8, ptr %idx.0, i8 1
%gep.idx.1 = getelementptr inbounds i8, ptr %idx.1, i8 1
br i1 %cond, label %if.then, label %loop.latch
if.then:
store i8 2, ptr %idx.0
store i8 1, ptr %idx.1
br label %loop.latch
loop.latch:
%i.next = add nuw nsw i64 %i, 1
%offset.0.next = add i64 %offset.0, 4611686018427387905 ; 2^62 + 1
%offset.1.next = add i64 %offset.1, 4611686018427387906 ; 2^62 + 2
%cond.exit = icmp eq i64 %i.next, 100
br i1 %cond.exit, label %exit, label %loop.header
exit:
store i32 0, ptr %gep.idx.0
store i32 0, ptr %gep.idx.1
ret void
}
define void @test_header_existing(ptr %src, ptr %dst, i64 %start) {
; CHECK-LABEL: 'test_header_existing'
; CHECK-NEXT: loop.header: