Skip to content

Commit 9d82ab8

Browse files
committed
[BasicAA] Add some test cases for coerced function args
1 parent 93505f8 commit 9d82ab8

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

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

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,51 @@ define void @test5(i64 %Q_as_int) {
5858
store i8 1, ptr %Q
5959
ret void
6060
}
61+
62+
; Verify that extractvalue of a coerced ptr argument array are NoAlias a function local object
63+
define void @test_extractvalue([2 x ptr] %Q.coerce) {
64+
; CHECK-LABEL: Function: test_extractvalue:
65+
; CHECK: NoAlias: i8* %P, i8* %Q
66+
%P = alloca i8
67+
%Q = extractvalue [2 x ptr] %Q.coerce, 1
68+
store i8 0, ptr %P
69+
store i8 1, ptr %Q
70+
ret void
71+
}
72+
73+
; Same as test_extractvalue with an escape of %P
74+
define void @test_extractvalue_escape([2 x ptr] %Q.coerce) {
75+
; CHECK-LABEL: Function: test_extractvalue_escape:
76+
; CHECK: MayAlias: i8* %P, i8* %Q
77+
%P = alloca i8
78+
call void @escape(ptr %P)
79+
%Q = extractvalue [2 x ptr] %Q.coerce, 1
80+
store i8 0, ptr %P
81+
store i8 1, ptr %Q
82+
ret void
83+
}
84+
85+
; Verify that extractvalue of a coerced ptr argument array are NoAlias a function local object
86+
define void @test_extractvalue_int([2 x i64] %Q.coerce) {
87+
; CHECK-LABEL: Function: test_extractvalue_int:
88+
; CHECK: NoAlias: i8* %P, i8* %Q
89+
%P = alloca i8
90+
%Q_as_int = extractvalue [2 x i64] %Q.coerce, 1
91+
%Q = inttoptr i64 %Q_as_int to ptr
92+
store i8 0, ptr %P
93+
store i8 1, ptr %Q
94+
ret void
95+
}
96+
97+
; Same as test_extractvalue_int with an escape of %P
98+
define void @test_extractvalue_int_escape([2 x i64] %Q.coerce) {
99+
; CHECK-LABEL: Function: test_extractvalue_int_escape:
100+
; CHECK: MayAlias: i8* %P, i8* %Q
101+
%P = alloca i8
102+
call void @escape(ptr %P)
103+
%Q_as_int = extractvalue [2 x i64] %Q.coerce, 1
104+
%Q = inttoptr i64 %Q_as_int to ptr
105+
store i8 0, ptr %P
106+
store i8 1, ptr %Q
107+
ret void
108+
}

0 commit comments

Comments
 (0)