https://github.com/AZero13 created 
https://github.com/llvm/llvm-project/pull/164875

It is supported in GlobalISel there. It is not supported on X86 GlobalISel.

>From ced69c74f84d318839ee4b4915d05e21f2fb3009 Mon Sep 17 00:00:00 2001
From: AZero13 <[email protected]>
Date: Thu, 23 Oct 2025 14:39:18 -0400
Subject: [PATCH] [CGObjC] Allow clang.arc.attachedcall on -O0 on AArch64

It is supported in GlobalISel there. It is not supported on X86 GlobalISel.
---
 clang/lib/CodeGen/CGObjC.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 10aad2e26938d..4920861327c4f 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -2417,7 +2417,7 @@ static llvm::Value 
*emitOptimizedARCReturnCall(llvm::Value *value,
   // Add operand bundle "clang.arc.attachedcall" to the call instead of 
emitting
   // retainRV or claimRV calls in the IR. We currently do this only when the
   // optimization level isn't -O0 since global-isel, which is currently run at
-  // -O0, doesn't know about the operand bundle.
+  // -O0, doesn't know about the operand bundle on x86_64.
   ObjCEntrypoints &EPs = CGF.CGM.getObjCEntrypoints();
   llvm::Function *&EP = IsRetainRV
                             ? EPs.objc_retainAutoreleasedReturnValue
@@ -2431,9 +2431,9 @@ static llvm::Value 
*emitOptimizedARCReturnCall(llvm::Value *value,
 
   // FIXME: Do this on all targets and at -O0 too. This can be enabled only if
   // the target backend knows how to handle the operand bundle.
-  if (CGF.CGM.getCodeGenOpts().OptimizationLevel > 0 &&
-      (Arch == llvm::Triple::aarch64 || Arch == llvm::Triple::aarch64_32 ||
-       Arch == llvm::Triple::x86_64)) {
+  if ((CGF.CGM.getCodeGenOpts().OptimizationLevel > 0 &&
+       Arch == llvm::Triple::x86_64) ||
+      (Arch == llvm::Triple::aarch64 || Arch == llvm::Triple::aarch64_32)) {
     llvm::Value *bundleArgs[] = {EP};
     llvm::OperandBundleDef OB("clang.arc.attachedcall", bundleArgs);
     auto *oldCall = cast<llvm::CallBase>(value);

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to