diff options
author | Dan Gohman <gohman@apple.com> | 2012-03-23 18:09:00 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2012-03-23 18:09:00 +0000 |
commit | 6fedb3c4016b8f706c472280a3a9b22430c73ef4 (patch) | |
tree | 6378ff2f28b76416921bf2d085a9d94a489c03da /test/Transforms/ObjCARC/invoke.ll | |
parent | fbab4a8c8a142502b7cdeb7112366f8560a94cec (diff) | |
download | llvm-6fedb3c4016b8f706c472280a3a9b22430c73ef4.tar.gz llvm-6fedb3c4016b8f706c472280a3a9b22430c73ef4.tar.bz2 llvm-6fedb3c4016b8f706c472280a3a9b22430c73ef4.tar.xz |
Don't convert objc_retainAutoreleasedReturnValue to objc_retain if it
is retaining the return value of an invoke that it immediately follows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153344 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/ObjCARC/invoke.ll')
-rw-r--r-- | test/Transforms/ObjCARC/invoke.ll | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/Transforms/ObjCARC/invoke.ll b/test/Transforms/ObjCARC/invoke.ll index a852c4e4fb..76e82a587b 100644 --- a/test/Transforms/ObjCARC/invoke.ll +++ b/test/Transforms/ObjCARC/invoke.ll @@ -6,6 +6,7 @@ declare i8* @objc_retainAutoreleasedReturnValue(i8*) declare i8* @objc_msgSend(i8*, i8*, ...) declare void @use_pointer(i8*) declare void @callee() +declare i8* @returner() ; ARCOpt shouldn't try to move the releases to the block containing the invoke. @@ -169,6 +170,48 @@ if.end: ret void } +; Don't turn the retainAutoreleaseReturnValue into retain, because it's +; for an invoke which we can assume codegen will put immediately prior. + +; CHECK: define void @test5( +; CHECK: call i8* @objc_retainAutoreleasedReturnValue(i8* %z) +; CHECK: } +define void @test5() { +entry: + %z = invoke i8* @returner() + to label %if.end unwind label %lpad, !clang.arc.no_objc_arc_exceptions !0 + +lpad: + %r13 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + cleanup + ret void + +if.end: + call i8* @objc_retainAutoreleasedReturnValue(i8* %z) + ret void +} + +; Like test5, but there's intervening code. + +; CHECK: define void @test6( +; CHECK: call i8* @objc_retain(i8* %z) +; CHECK: } +define void @test6() { +entry: + %z = invoke i8* @returner() + to label %if.end unwind label %lpad, !clang.arc.no_objc_arc_exceptions !0 + +lpad: + %r13 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*) + cleanup + ret void + +if.end: + call void @callee() + call i8* @objc_retainAutoreleasedReturnValue(i8* %z) + ret void +} + declare i32 @__gxx_personality_v0(...) declare i32 @__objc_personality_v0(...) |