[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
Thu May 16 15:10:43 PDT 2019
ahatanak marked an inline comment as done.
ahatanak added inline comments.
================
Comment at: lib/CodeGen/CGObjC.cpp:2611
+ if (!CGM.getCodeGenOpts().ObjCNoBuiltinRetainRelease && !getInvokeDest())
+ return EmitARCRetainAutoreleasedReturnValue(value, returnType);
return emitObjCValueOperation(
----------------
ahatanak wrote:
> rjmccall wrote:
> > Same question: won't this make it significantly more difficult to detect when we're generating bad code? And the overhead here (on every retain in MRC!) is pretty significant; shouldn't this at least be restricted to situations where it's plausible that it might be reclaiming something, like when the receiver expression is a function call of some sort?
> As I mentioned in my response to David's question, I was thinking the ARC optimizer would be able to convert an `objc_retainAutoreleasedReturnValue` call to an `objc_retain` call. However, after reading your comment in https://reviews.llvm.org/D61970, I don't think it's okay to use the ARC optimizer to transform code that was compiled in MRR mode.
I meant the comment in https://reviews.llvm.org/D61808.
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