[PATCH] D61970: [CodeGen][ObjC] Call objc_autoreleaseReturnValue and objc_retainAutoreleasedReturnValue instead of objc_autorelease and objc_retain in MRR

Akira Hatanaka via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 15 17:03:28 PDT 2019


ahatanak created this revision.
ahatanak added reviewers: pete, rjmccall, erik.pilkington.
ahatanak added a project: clang.
Herald added subscribers: dexonsmith, jkorous.

This patch makes IRGen emit ObjC runtime functions (`objc_autoreleaseReturnValue` and `objc_retainAutoreleasedReturnValue`) that were previously emitted only in ARC mode. This enables retain message sends in MRR code to participate in the retainRV/autoreleaseRV handshake, which keeps returned objects out of the autorelease pool. Also, it enables the ARC optimizer and ARC contract pass to remove retain/autorelease pairs and mark autorelease message sends converted to autoreleaseRV calls as tail calls, which is necessary for the retainRV/autoreleaseRV handshake to succeed.

rdar://problem/50353574


Repository:
  rC Clang

https://reviews.llvm.org/D61970

Files:
  include/clang/Basic/CodeGenOptions.def
  include/clang/Driver/Options.td
  lib/CodeGen/CGObjC.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/Driver/ToolChains/Clang.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGenObjC/convert-messages-to-runtime-calls.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61970.199700.patch
Type: text/x-patch
Size: 10760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190516/7e0bb52a/attachment-0001.bin>


More information about the cfe-commits mailing list