[Coroutines] Use default attributes for some coro intrinsics
authorNikita Popov <npopov@redhat.com>
Fri, 28 Oct 2022 09:42:10 +0000 (11:42 +0200)
committerNikita Popov <npopov@redhat.com>
Mon, 31 Oct 2022 08:39:22 +0000 (09:39 +0100)
This adds the default attributes (nosync, nofree, nocallback,
willreturn) to the coro.id and coro.subfn.addr intrinsics. This
is needed to avoid optimization regressions in the future.

It's probably possible to use default attributes for most other
coro intrinsics as well, but I only hit these as problematic in
practice.

Differential Revision: https://reviews.llvm.org/D136932

llvm/include/llvm/IR/Intrinsics.td

index 025dd80..bfe69f3 100644 (file)
@@ -1269,11 +1269,10 @@ def int_experimental_gc_get_pointer_offset : Intrinsic<[llvm_i64_ty],
 
 // Coroutine Structure Intrinsics.
 
-def int_coro_id : Intrinsic<[llvm_token_ty], [llvm_i32_ty, llvm_ptr_ty,
-                             llvm_ptr_ty, llvm_ptr_ty],
-                            [IntrArgMemOnly, IntrReadMem,
-                             ReadNone<ArgIndex<1>>, ReadOnly<ArgIndex<2>>,
-                             NoCapture<ArgIndex<2>>]>;
+def int_coro_id : DefaultAttrsIntrinsic<[llvm_token_ty],
+    [llvm_i32_ty, llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty],
+    [IntrArgMemOnly, IntrReadMem, ReadNone<ArgIndex<1>>, ReadOnly<ArgIndex<2>>,
+     NoCapture<ArgIndex<2>>]>;
 def int_coro_id_retcon : Intrinsic<[llvm_token_ty],
     [llvm_i32_ty, llvm_i32_ty, llvm_ptr_ty,
      llvm_ptr_ty, llvm_ptr_ty, llvm_ptr_ty],
@@ -1341,10 +1340,10 @@ def int_coro_promise : Intrinsic<[llvm_ptr_ty],
 
 // Coroutine Lowering Intrinsics. Used internally by coroutine passes.
 
-def int_coro_subfn_addr : Intrinsic<[llvm_ptr_ty], [llvm_ptr_ty, llvm_i8_ty],
-                                    [IntrReadMem, IntrArgMemOnly,
-                                     ReadOnly<ArgIndex<0>>,
-                                     NoCapture<ArgIndex<0>>]>;
+def int_coro_subfn_addr : DefaultAttrsIntrinsic<
+    [llvm_ptr_ty], [llvm_ptr_ty, llvm_i8_ty],
+    [IntrReadMem, IntrArgMemOnly, ReadOnly<ArgIndex<0>>,
+     NoCapture<ArgIndex<0>>]>;
 
 ///===-------------------------- Other Intrinsics --------------------------===//
 //