[llvm] 3cb8a52 - [LAA] Add additional tests for #161445.
    Florian Hahn via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sun Oct 26 19:39:35 PDT 2025
    
    
  
Author: Florian Hahn
Date: 2025-10-27T02:39:09Z
New Revision: 3cb8a52e2d4f26373dfeb568707019784ebe0b43
URL: https://github.com/llvm/llvm-project/commit/3cb8a52e2d4f26373dfeb568707019784ebe0b43
DIFF: https://github.com/llvm/llvm-project/commit/3cb8a52e2d4f26373dfeb568707019784ebe0b43.diff
LOG: [LAA] Add additional tests for #161445.
Add extra test variants for
https://github.com/llvm/llvm-project/pull/161445.
Added: 
    
Modified: 
    llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll
Removed: 
    
################################################################################
diff  --git a/llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll b/llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll
index 6eed0ec864820..4c2a9c3f29f02 100644
--- a/llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll
+++ b/llvm/test/Analysis/LoopAccessAnalysis/inbounds-gep-in-predicated-blocks.ll
@@ -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:
        
    
    
More information about the llvm-commits
mailing list