[llvm] e66c205 - [AA] Add additional tests for mixed of different captures (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 02:04:19 PDT 2025


Author: Nikita Popov
Date: 2025-06-06T11:04:09+02:00
New Revision: e66c205bda33a91fbe2ba5b4a5d6b823e5c23e8a

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

LOG: [AA] Add additional tests for mixed of different captures (NFC)

Added: 
    

Modified: 
    llvm/test/Analysis/BasicAA/captures.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Analysis/BasicAA/captures.ll b/llvm/test/Analysis/BasicAA/captures.ll
index fcc51b54b71b8..c212a466f8ede 100644
--- a/llvm/test/Analysis/BasicAA/captures.ll
+++ b/llvm/test/Analysis/BasicAA/captures.ll
@@ -40,3 +40,42 @@ define void @address_capture_and_full_capture() {
   load i32, ptr %a
   ret void
 }
+
+; CHECK-LABEL: address_capture_and_full_capture_commuted
+; CHECK: MayAlias:	i32* %a, i32* %p
+; CHECK: Both ModRef:  Ptr: i32* %a	<->  %p = call ptr @get_ptr()
+define void @address_capture_and_full_capture_commuted() {
+  %a = alloca i32
+  call void @capture(ptr %a)
+  call void @capture(ptr captures(address) %a)
+  %p = call ptr @get_ptr()
+  store i32 0, ptr %p
+  load i32, ptr %a
+  ret void
+}
+
+; CHECK-LABEL: read_only_capture_and_full_capture
+; CHECK: MayAlias:	i32* %a, i32* %p
+; CHECK: Both ModRef:  Ptr: i32* %a	<->  %p = call ptr @get_ptr()
+define void @read_only_capture_and_full_capture() {
+  %a = alloca i32
+  call void @capture(ptr captures(address, read_provenance) %a)
+  call void @capture(ptr %a)
+  %p = call ptr @get_ptr()
+  store i32 0, ptr %p
+  load i32, ptr %a
+  ret void
+}
+
+; CHECK-LABEL: read_only_capture_and_full_capture_commuted
+; CHECK: MayAlias:	i32* %a, i32* %p
+; CHECK: Both ModRef:  Ptr: i32* %a	<->  %p = call ptr @get_ptr()
+define void @read_only_capture_and_full_capture_commuted() {
+  %a = alloca i32
+  call void @capture(ptr %a)
+  call void @capture(ptr captures(address, read_provenance) %a)
+  %p = call ptr @get_ptr()
+  store i32 0, ptr %p
+  load i32, ptr %a
+  ret void
+}


        


More information about the llvm-commits mailing list