[llvm] d01653f - [rs4gc] add tests for existing code stripping attributes from function signatures

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 2 09:04:09 PDT 2021


Author: Philip Reames
Date: 2021-04-02T08:59:55-07:00
New Revision: d01653f827cc962734f464be9502eb16cd907a44

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

LOG: [rs4gc] add tests for existing code stripping attributes from function signatures

Added: 
    llvm/test/Transforms/RewriteStatepointsForGC/strip-invalid-attributes.ll

Modified: 
    

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/RewriteStatepointsForGC/strip-invalid-attributes.ll b/llvm/test/Transforms/RewriteStatepointsForGC/strip-invalid-attributes.ll
new file mode 100644
index 0000000000000..bc3d970df5963
--- /dev/null
+++ b/llvm/test/Transforms/RewriteStatepointsForGC/strip-invalid-attributes.ll
@@ -0,0 +1,45 @@
+; RUN: opt -S -rewrite-statepoints-for-gc  < %s | FileCheck %s
+; RUN: opt -S -passes=rewrite-statepoints-for-gc  < %s | FileCheck %s
+
+
+; Ensure we're stipping attributes from the function signatures which are invalid
+; after inserting safepoints with explicit memory semantics
+
+declare void @f()
+
+define i8 addrspace(1)* @deref_arg(i8 addrspace(1)* dereferenceable(16) %arg) gc "statepoint-example" {
+; CHECK: define i8 addrspace(1)* @deref_arg(i8 addrspace(1)* %arg)
+  call void @f()
+  ret i8 addrspace(1)* %arg
+}
+
+define dereferenceable(16) i8 addrspace(1)* @deref_ret(i8 addrspace(1)* %arg) gc "statepoint-example" {
+; CHECK: define i8 addrspace(1)* @deref_ret(i8 addrspace(1)* %arg)
+  call void @f()
+  ret i8 addrspace(1)* %arg
+}
+
+define i8 addrspace(1)* @deref_or_null_arg(i8 addrspace(1)* dereferenceable_or_null(16) %arg) gc "statepoint-example" {
+; CHECK: define i8 addrspace(1)* @deref_or_null_arg(i8 addrspace(1)* %arg)
+  call void @f()
+  ret i8 addrspace(1)* %arg
+}
+
+define dereferenceable_or_null(16) i8 addrspace(1)* @deref_or_null_ret(i8 addrspace(1)* %arg) gc "statepoint-example" {
+; CHECK: define i8 addrspace(1)* @deref_or_null_ret(i8 addrspace(1)* %arg)
+  call void @f()
+  ret i8 addrspace(1)* %arg
+}
+
+define i8 addrspace(1)* @noalias_arg(i8 addrspace(1)* noalias %arg) gc "statepoint-example" {
+; CHECK: define i8 addrspace(1)* @noalias_arg(i8 addrspace(1)* %arg)
+  call void @f()
+  ret i8 addrspace(1)* %arg
+}
+
+define noalias i8 addrspace(1)* @noalias_ret(i8 addrspace(1)* %arg) gc "statepoint-example" {
+; CHECK: define i8 addrspace(1)* @noalias_ret(i8 addrspace(1)* %arg)
+  call void @f()
+  ret i8 addrspace(1)* %arg
+}
+


        


More information about the llvm-commits mailing list