[PATCH] D103000: [ObjC][ARC] Use the addresses of the ARC runtime functions instead of integer 0/1 for the operand of bundle "clang.arc.attachedcall"

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 5 02:16:35 PDT 2021


fhahn added inline comments.


================
Comment at: llvm/include/llvm/Analysis/ObjCARCUtil.h:30
+/// clang_arc_attachedcall and returns the pointer to the ARC runtime function.
+inline std::pair<bool, Function *> getAttachedARCFunction(const CallBase *CB) {
+  auto B = CB->getOperandBundle(LLVMContext::OB_clang_arc_attachedcall);
----------------
Perhaps simpler to return an optional?


================
Comment at: llvm/lib/Target/X86/X86ISelLowering.cpp:4454
     unsigned RuntimeCallType =
-        objcarc::hasAttachedCallOpBundle(CLI.CB, true) ? 0 : 1;
+        ARCFn == M->getFunction("objc_retainAutoreleasedReturnValue") ? 0 : 1;
     Ops.insert(Ops.begin() + 1,
----------------
Would to be possible to add an operand with the symbol of the function instead a number here? 


================
Comment at: llvm/lib/Transforms/Utils/InlineFunction.cpp:1675
   Module *Mod = CB.getModule();
-  bool IsRetainRV = objcarc::hasAttachedCallOpBundle(&CB, true),
+  assert(((RVCallKind == objcarc::ARCInstKind::RetainRV) ||
+          (RVCallKind == objcarc::ARCInstKind::ClaimRV)) &&
----------------
Would it make sense to have a function in the ‘obj arc’’ namespace to check IsRetainRV instead of duplicating the check + assertion in multiple paces?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103000



More information about the llvm-commits mailing list