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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 13:59:20 PDT 2021


fhahn added a comment.

Thanks for taking a look!

In D94597#2632806 <https://reviews.llvm.org/D94597#2632806>, @ab wrote:

> Can you (or @ahatanak) explain why/how this needs to be different from aarch64?  In particular I don't think I understand why you need to emit the retainARV/claimARV calls this late, that seems like quite a drastic difference in behavior for the bundle.

Unfortunately the ObjC runtime matches different sequences on AArc64 and X86. This is documented here https://github.com/opensource-apple/objc4/blob/master/runtime/objc-object.h#L974

On AArch64, the callee only checks for `mov x29, x29` in the caller and the position of the claim/autorelease runtime call does not matter, which makes things much simpler. On X86_64, it specifically looks for the marker instructions, immediately followed by the runtime call. So we want to make sure that it is very hard to break up this specific sequence, to avoid missing out on the runtime optimization.

> 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.


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