[PATCH] D94597: [X86] Lower calls with clang.arc.attachedcall bundle

Akira Hatanaka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 22 09:31:35 PDT 2021


ahatanak added a comment.

In D94597#2632887 <https://reviews.llvm.org/D94597#2632887>, @fhahn wrote:

> In D94597#2632806 <https://reviews.llvm.org/D94597#2632806>, @ab wrote:
>
>> I read through the discussion in D92808 <https://reviews.llvm.org/D92808> but it sounds like that predates the x86_64-specific behavior, right?  But skimming around the various passes involved I'm not actually sure who emits the retainARV/claimARV calls on aarch64.
>
> On AArch64 I think that happens during the lowering of the ARC intrinsics pre-ISel, but @ahatanak would know more about the exact place.

ARC contract pass inserts the retainRV/claimRV calls before transforming the function. After the transformation is done, the pass removes the inserted runtime calls on x86-64, but leaves the calls in the IR on AArch64.

On AArch64, `objc_autoreleaseReturnValue`, which the callee calls before returning, looks for only the marker instruction, so it's not necessary for the retainRV/claimRV instructions to immediately follow the function call and the marker instruction. On x86-64, it looks for a `movq` first and then a retainRV/claimRV call immediately following the `movq`.

See `callerAcceptsOptimizedReturn` in the code below:

https://opensource.apple.com/source/objc4/objc4-818.2/runtime/objc-object.h.auto.html


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94597



More information about the llvm-commits mailing list