[clang] Enable direct methods and fast alloc calls for libobjc2. (PR #78030)

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 21 14:51:55 PST 2024


================
@@ -2649,13 +2767,18 @@ CGObjCGNU::GenerateMessageSend(CodeGenFunction &CGF,
     }
   }
 
+  bool isDirect = Method && Method->isDirectMethod();
+
   IdTy = cast<llvm::PointerType>(CGM.getTypes().ConvertType(ASTIdTy));
   llvm::Value *cmd;
-  if (Method)
-    cmd = GetSelector(CGF, Method);
-  else
-    cmd = GetSelector(CGF, Sel);
-  cmd = EnforceType(Builder, cmd, SelectorTy);
+  if (!isDirect) {
+    if (Method)
+      cmd = GetSelector(CGF, Method);
+    else
+      cmd = GetSelector(CGF, Sel);
----------------
compnerd wrote:

Probably more compact as a ternary.

https://github.com/llvm/llvm-project/pull/78030


More information about the cfe-commits mailing list