[llvm] 9d82ab8 - [BasicAA] Add some test cases for coerced function args

David Green via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 8 02:02:29 PDT 2025


Author: David Green
Date: 2025-04-08T10:02:24+01:00
New Revision: 9d82ab8a8222f22048074488d5036ae5228088c5

URL: https://github.com/llvm/llvm-project/commit/9d82ab8a8222f22048074488d5036ae5228088c5
DIFF: https://github.com/llvm/llvm-project/commit/9d82ab8a8222f22048074488d5036ae5228088c5.diff

LOG: [BasicAA] Add some test cases for coerced function args

Added: 
    

Modified: 
    llvm/test/Analysis/BasicAA/noalias-inttoptr.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/BasicAA/noalias-inttoptr.ll b/llvm/test/Analysis/BasicAA/noalias-inttoptr.ll
index 24bbcc55b3202..72f9adc5a74bf 100644
--- a/llvm/test/Analysis/BasicAA/noalias-inttoptr.ll
+++ b/llvm/test/Analysis/BasicAA/noalias-inttoptr.ll
@@ -58,3 +58,51 @@ define void @test5(i64 %Q_as_int) {
   store i8 1, ptr %Q
   ret void
 }
+
+; Verify that extractvalue of a coerced ptr argument array are NoAlias a function local object
+define void @test_extractvalue([2 x ptr] %Q.coerce) {
+  ; CHECK-LABEL: Function: test_extractvalue:
+  ; CHECK: NoAlias:    i8* %P, i8* %Q
+  %P = alloca i8
+  %Q = extractvalue [2 x ptr] %Q.coerce, 1
+  store i8 0, ptr %P
+  store i8 1, ptr %Q
+  ret void
+}
+
+; Same as test_extractvalue with an escape of %P
+define void @test_extractvalue_escape([2 x ptr] %Q.coerce) {
+  ; CHECK-LABEL: Function: test_extractvalue_escape:
+  ; CHECK: MayAlias:    i8* %P, i8* %Q
+  %P = alloca i8
+  call void @escape(ptr %P)
+  %Q = extractvalue [2 x ptr] %Q.coerce, 1
+  store i8 0, ptr %P
+  store i8 1, ptr %Q
+  ret void
+}
+
+; Verify that extractvalue of a coerced ptr argument array are NoAlias a function local object
+define void @test_extractvalue_int([2 x i64] %Q.coerce) {
+  ; CHECK-LABEL: Function: test_extractvalue_int:
+  ; CHECK: NoAlias:    i8* %P, i8* %Q
+  %P = alloca i8
+  %Q_as_int = extractvalue [2 x i64] %Q.coerce, 1
+  %Q = inttoptr i64 %Q_as_int to ptr
+  store i8 0, ptr %P
+  store i8 1, ptr %Q
+  ret void
+}
+
+; Same as test_extractvalue_int with an escape of %P
+define void @test_extractvalue_int_escape([2 x i64] %Q.coerce) {
+  ; CHECK-LABEL: Function: test_extractvalue_int_escape:
+  ; CHECK: MayAlias:    i8* %P, i8* %Q
+  %P = alloca i8
+  call void @escape(ptr %P)
+  %Q_as_int = extractvalue [2 x i64] %Q.coerce, 1
+  %Q = inttoptr i64 %Q_as_int to ptr
+  store i8 0, ptr %P
+  store i8 1, ptr %Q
+  ret void
+}
\ No newline at end of file


        


More information about the llvm-commits mailing list