diff options
author | Michael Gottesman <mgottesman@apple.com> | 2013-01-12 01:25:15 +0000 |
---|---|---|
committer | Michael Gottesman <mgottesman@apple.com> | 2013-01-12 01:25:15 +0000 |
commit | c9656faf1e73998b0ca0f0aff6652fec69c02c64 (patch) | |
tree | 234b8723a4012673e6580cce670537e3d4534ea2 /llvm/test/Transforms/ObjCARC/move-and-form-retain-autorelease.ll | |
parent | e274088db052f89254a050c3f255bad9f92ddea5 (diff) | |
download | bcm5719-llvm-c9656faf1e73998b0ca0f0aff6652fec69c02c64.tar.gz bcm5719-llvm-c9656faf1e73998b0ca0f0aff6652fec69c02c64.zip |
Fixed a bug where we were tail calling objc_autorelease causing an object to not be placed into an autorelease pool.
The reason that this occurs is that tail calling objc_autorelease eventually
tail calls -[NSObject autorelease] which supports fast autorelease. This can
cause us to violate the semantic gaurantees of __autoreleasing variables that
assignment to an __autoreleasing variables always yields an object that is
placed into the innermost autorelease pool.
The fix included in this patch works by:
1. In the peephole optimization function OptimizeIndividualFunctions, always
remove tail call from objc_autorelease.
2. Whenever we convert to/from an objc_autorelease, set/unset the tail call
keyword as appropriate.
*NOTE* I also handled the case where objc_autorelease is converted in
OptimizeReturns to an autoreleaseRV which still violates the ARC semantics. I
will be removing that in a later patch and I wanted to make sure that the tree
is in a consistent state vis-a-vis ARC always.
Additionally some test cases are provided and all tests that have tail call marked
objc_autorelease keywords have been modified so that tail call has been removed.
*NOTE* One test fails due to a separate bug that I am going to commit soon. Thus
I marked the check line TMP: instead of CHECK: so make check does not fail.
llvm-svn: 172287
Diffstat (limited to 'llvm/test/Transforms/ObjCARC/move-and-form-retain-autorelease.ll')
-rw-r--r-- | llvm/test/Transforms/ObjCARC/move-and-form-retain-autorelease.ll | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/test/Transforms/ObjCARC/move-and-form-retain-autorelease.ll b/llvm/test/Transforms/ObjCARC/move-and-form-retain-autorelease.ll index 170d0a99c98..d7a54ab4308 100644 --- a/llvm/test/Transforms/ObjCARC/move-and-form-retain-autorelease.ll +++ b/llvm/test/Transforms/ObjCARC/move-and-form-retain-autorelease.ll @@ -212,7 +212,7 @@ bb99: ; preds = %bb57 br label %bb104 bb104: ; preds = %bb99, %bb57 - %tmp105 = tail call i8* @objc_autorelease(i8* %tmp72) nounwind + %tmp105 = call i8* @objc_autorelease(i8* %tmp72) nounwind %tmp106 = bitcast i8* %tmp105 to %14* tail call void @objc_release(i8* %tmp85) nounwind %tmp107 = bitcast %18* %tmp47 to i8* |