[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 23:57:34 PDT 2019
ahatanak added inline comments.
================
Comment at: test/CodeGenObjC/convert-messages-to-runtime-calls.m:32
// CALLS: {{call.*@objc_allocWithZone}}
- // CALLS: {{call.*@objc_retain}}
+ // CALLS-ARC-INTRINSICS: {{call.*@llvm.objc.retainAutoreleasedReturnValue}}
+ // CALLS-NO-ARC-INTRINSICS: {{call.*@objc_retain}}
----------------
ddkilzer wrote:
> Silly question: Should `objc_retainAutoreleasedReturnValue` really be called here when the value is not used in a `return` statement?
ARC optimizer has an optimization that converts a call to `objc_retainAutoreleasedReturnValue` to a call to `objc_retain` when it doesn't use the result of a call.
http://llvm.org/doxygen/ObjCARCOpts_8cpp_source.html
Also, it converts a call to `objc_autoreleaseReturnValue` to a call to `objc_autorelease` when its result isn't used by a return instruction.
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61970/new/
https://reviews.llvm.org/D61970
More information about the cfe-commits
mailing list