[PATCH] D92808: [ObjC][ARC] Annotate calls with attributes instead of emitting retainRV or claimRV calls in the IR

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 8 17:11:23 PST 2020


ahatanak added inline comments.


================
Comment at: clang/lib/CodeGen/CGObjC.cpp:2328
+      CGF.CGM.getTarget().getTriple().isAArch64() &&
+      !CGF.CGM.getTarget().getTriple().isOSWindows()) {
+    auto *callBase = cast<llvm::CallBase>(value);
----------------
rjmccall wrote:
> It would be good to explain why this is target-specific in a comment.
I didn't really have a reason for limiting this to arm64 and non-windows OS other than I didn't want to do too many things in the initial patch. I don't think it would be hard to do this on x86-64. For windows, it looks like we'll have to emit the markers and the ARC calls before CodeGen (before WinEHPrepare) is run, but I haven't thought it through.


================
Comment at: clang/lib/CodeGen/CGObjC.cpp:2334
+                               IsRetainRV ? "retainRV" : "claimRV");
+    if (CGF.CGM.getModule().getModuleFlag(markerKey))
+      attrs = attrs.addAttribute(CGF.getLLVMContext(),
----------------
rjmccall wrote:
> Didn't we just add this?  Can that fail to add the marker?
The check for module flag was here because the initial version of this patch added the attribute when the target wasn't arm64 (e.g., x86-64) too. I've removed the check for now.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92808/new/

https://reviews.llvm.org/D92808



More information about the cfe-commits mailing list