[PATCH] D61808: [ObjC] Replace uses of the argument of a call to objc_autorelease with the result in MRR
John McCall via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 16 15:20:34 PDT 2019
rjmccall added a comment.
In D61808#1505544 <https://reviews.llvm.org/D61808#1505544>, @ahatanak wrote:
> In D61808#1505023 <https://reviews.llvm.org/D61808#1505023>, @rjmccall wrote:
>
> > The assumption that these methods return the receiver is not true without additional semantic assumptions about these methods, so the current behavior of unconditionally turning `[x autorelease]` into `objc_autorelease(x), x` seems quite broken.
>
>
> Because it's possible to override an autorelease method and make the method return something other than the passed argument, for example?
>
> If it's not possible to assume that the method returns the passed argument in MRR, the direction of this patch and https://reviews.llvm.org/D61970 is completely wrong.
Well, `objc_retain` and `objc_autorelease` (and `objc_release`, trivially) do return the normal return value of the message send in MRR, so assuming that's preserved in the IR, you just need to use that as the expression result. But if the backend's going to unconditionally optimize the intrinsics based on the assumption that those values are the same, that's problematic, just as it would be problematic for it to do ARC-approved reordering on intrinsics emitted for MRR.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61808/new/
https://reviews.llvm.org/D61808
More information about the llvm-commits
mailing list