[llvm-branch-commits] [llvm] RuntimeLibcalls: Add attributes to ObjC runtime calls (PR #244695)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Nov 20 11:52:09 PST 2026


https://github.com/arsenm created https://github.com/llvm/llvm-project/pull/244695

Mark the ObjC runtime functions nounwind, and mark the argument of
the functions whose intrinsics mark their argument returned.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>

>From b63223a33e2d84b522666b948e747105296472f1 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Fri, 20 Nov 2026 11:27:42 -0500
Subject: [PATCH] RuntimeLibcalls: Add attributes to ObjC runtime calls

Mark the ObjC runtime functions nounwind, and mark the argument of
the functions whose intrinsics mark their argument returned.

Co-authored-by: Claude Opus 5.5 <noreply at anthropic.com>
---
 llvm/include/llvm/IR/RuntimeLibcalls.td | 57 ++++++++++++++-----------
 1 file changed, 31 insertions(+), 26 deletions(-)

diff --git a/llvm/include/llvm/IR/RuntimeLibcalls.td b/llvm/include/llvm/IR/RuntimeLibcalls.td
index 78a8de4ef7529..a7f736233d188 100644
--- a/llvm/include/llvm/IR/RuntimeLibcalls.td
+++ b/llvm/include/llvm/IR/RuntimeLibcalls.td
@@ -1142,32 +1142,37 @@ def HEXAGON_VOLATILE_MEMCPY : RuntimeLibcall<Void, [Ptr, Ptr, UInt]>;
 def MEMCPY_ALIGN_4 : VoidMemCpyLibcall;
 
 // Objective-C calls
-def OBJC_AUTORELEASE : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_AUTORELEASEPOOLPOP : RuntimeLibcall<Void, [Ptr]>;
-def OBJC_AUTORELEASEPOOLPUSH : RuntimeLibcall<Ptr, []>;
-def OBJC_AUTORELEASERETURNVALUE : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_COPYWEAK : RuntimeLibcall<Void, [Ptr, Ptr]>;
-def OBJC_DESTROYWEAK : RuntimeLibcall<Void, [Ptr]>;
-def OBJC_INITWEAK : RuntimeLibcall<Ptr, [Ptr, Ptr]>;
-def OBJC_LOADWEAK : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_LOADWEAKRETAINED : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_MOVEWEAK : RuntimeLibcall<Void, [Ptr, Ptr]>;
-def OBJC_RELEASE : RuntimeLibcall<Void, [Ptr]>;
-def OBJC_RETAIN : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_RETAINAUTORELEASE : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_RETAINAUTORELEASERETURNVALUE : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_RETAINAUTORELEASEDRETURNVALUE : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_CLAIMAUTORELEASEDRETURNVALUE : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_RETAINBLOCK : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_STORESTRONG : RuntimeLibcall<Void, [Ptr, Ptr]>;
-def OBJC_STOREWEAK : RuntimeLibcall<Ptr, [Ptr, Ptr]>;
-def OBJC_UNSAFECLAIMAUTORELEASEDRETURNVALUE : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_RETAINEDOBJECT : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_UNRETAINEDOBJECT : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_UNRETAINEDPOINTER : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_RETAIN_AUTORELEASE : RuntimeLibcall<Ptr, [Ptr]>;
-def OBJC_SYNC_ENTER : RuntimeLibcall<Int, [Ptr]>;
-def OBJC_SYNC_EXIT : RuntimeLibcall<Int, [Ptr]>;
+class ObjCReturnedLibcall : RuntimeLibcall<Ptr, [Ptr]> {
+  let FnAttrs = [NoUnwind];
+  let ParamAttrs = [[Returned]];
+}
+
+def OBJC_AUTORELEASE : ObjCReturnedLibcall;
+def OBJC_AUTORELEASEPOOLPOP : NoUnwindLibcall<Void, [Ptr]>;
+def OBJC_AUTORELEASEPOOLPUSH : NoUnwindLibcall<Ptr>;
+def OBJC_AUTORELEASERETURNVALUE : ObjCReturnedLibcall;
+def OBJC_COPYWEAK : NoUnwindLibcall<Void, [Ptr, Ptr]>;
+def OBJC_DESTROYWEAK : NoUnwindLibcall<Void, [Ptr]>;
+def OBJC_INITWEAK : NoUnwindLibcall<Ptr, [Ptr, Ptr]>;
+def OBJC_LOADWEAK : NoUnwindLibcall<Ptr, [Ptr]>;
+def OBJC_LOADWEAKRETAINED : NoUnwindLibcall<Ptr, [Ptr]>;
+def OBJC_MOVEWEAK : NoUnwindLibcall<Void, [Ptr, Ptr]>;
+def OBJC_RELEASE : NoUnwindLibcall<Void, [Ptr]>;
+def OBJC_RETAIN : ObjCReturnedLibcall;
+def OBJC_RETAINAUTORELEASE : ObjCReturnedLibcall;
+def OBJC_RETAINAUTORELEASERETURNVALUE : ObjCReturnedLibcall;
+def OBJC_RETAINAUTORELEASEDRETURNVALUE : NoUnwindLibcall<Ptr, [Ptr]>;
+def OBJC_CLAIMAUTORELEASEDRETURNVALUE : NoUnwindLibcall<Ptr, [Ptr]>;
+def OBJC_RETAINBLOCK : NoUnwindLibcall<Ptr, [Ptr]>;
+def OBJC_STORESTRONG : NoUnwindLibcall<Void, [Ptr, Ptr]>;
+def OBJC_STOREWEAK : NoUnwindLibcall<Ptr, [Ptr, Ptr]>;
+def OBJC_UNSAFECLAIMAUTORELEASEDRETURNVALUE : NoUnwindLibcall<Ptr, [Ptr]>;
+def OBJC_RETAINEDOBJECT : NoUnwindLibcall<Ptr, [Ptr]>;
+def OBJC_UNRETAINEDOBJECT : NoUnwindLibcall<Ptr, [Ptr]>;
+def OBJC_UNRETAINEDPOINTER : NoUnwindLibcall<Ptr, [Ptr]>;
+def OBJC_RETAIN_AUTORELEASE : ObjCReturnedLibcall;
+def OBJC_SYNC_ENTER : NoUnwindLibcall<Int, [Ptr]>;
+def OBJC_SYNC_EXIT : NoUnwindLibcall<Int, [Ptr]>;
 
 class PrintfLibcall : RuntimeLibcall<Int, [Ptr, Ellip]> {
   let FnAttrs = [NoFree, NoUnwind];



More information about the llvm-branch-commits mailing list