Remove an optimization where we were changing an objc_autorelease into an objc_autore...
authorMichael Gottesman <mgottesman@apple.com>
Wed, 3 Apr 2013 02:57:24 +0000 (02:57 +0000)
committerMichael Gottesman <mgottesman@apple.com>
Wed, 3 Apr 2013 02:57:24 +0000 (02:57 +0000)
commita67a20c95f08b31b499d06d1fa47bdf14f9d40d0
treef06bdd22f1809d7c7bc82828b878617814f359d8
parent003d5f946d3ad44cb42f7d25b0c40f04e9a5a0a2
Remove an optimization where we were changing an objc_autorelease into an objc_autoreleaseReturnValue.

The semantics of ARC implies that a pointer passed into an objc_autorelease
must live until some point (potentially down the stack) where an
autorelease pool is popped. On the other hand, an
objc_autoreleaseReturnValue just signifies that the object must live
until the end of the given function at least.

Thus objc_autorelease is stronger than objc_autoreleaseReturnValue in
terms of the semantics of ARC* implying that performing the given
strength reduction without any knowledge of how this relates to
the autorelease pool pop that is further up the stack violates the
semantics of ARC.

*Even though objc_autoreleaseReturnValue if you know that no RV
optimization will occur is more computationally expensive.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178612 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/ObjCARC/ObjCARCOpts.cpp
test/Transforms/ObjCARC/basic.ll
test/Transforms/ObjCARC/rv.ll
test/Transforms/ObjCARC/tail-call-invariant-enforcement.ll