Skip to content

Commit e66c205

Browse files
committed
[AA] Add additional tests for mixed of different captures (NFC)
1 parent 5f33b9d commit e66c205

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

llvm/test/Analysis/BasicAA/captures.ll

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,42 @@ define void @address_capture_and_full_capture() {
4040
load i32, ptr %a
4141
ret void
4242
}
43+
44+
; CHECK-LABEL: address_capture_and_full_capture_commuted
45+
; CHECK: MayAlias: i32* %a, i32* %p
46+
; CHECK: Both ModRef: Ptr: i32* %a <-> %p = call ptr @get_ptr()
47+
define void @address_capture_and_full_capture_commuted() {
48+
%a = alloca i32
49+
call void @capture(ptr %a)
50+
call void @capture(ptr captures(address) %a)
51+
%p = call ptr @get_ptr()
52+
store i32 0, ptr %p
53+
load i32, ptr %a
54+
ret void
55+
}
56+
57+
; CHECK-LABEL: read_only_capture_and_full_capture
58+
; CHECK: MayAlias: i32* %a, i32* %p
59+
; CHECK: Both ModRef: Ptr: i32* %a <-> %p = call ptr @get_ptr()
60+
define void @read_only_capture_and_full_capture() {
61+
%a = alloca i32
62+
call void @capture(ptr captures(address, read_provenance) %a)
63+
call void @capture(ptr %a)
64+
%p = call ptr @get_ptr()
65+
store i32 0, ptr %p
66+
load i32, ptr %a
67+
ret void
68+
}
69+
70+
; CHECK-LABEL: read_only_capture_and_full_capture_commuted
71+
; CHECK: MayAlias: i32* %a, i32* %p
72+
; CHECK: Both ModRef: Ptr: i32* %a <-> %p = call ptr @get_ptr()
73+
define void @read_only_capture_and_full_capture_commuted() {
74+
%a = alloca i32
75+
call void @capture(ptr %a)
76+
call void @capture(ptr captures(address, read_provenance) %a)
77+
%p = call ptr @get_ptr()
78+
store i32 0, ptr %p
79+
load i32, ptr %a
80+
ret void
81+
}

0 commit comments

Comments
 (0)