diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2017-08-31 18:27:47 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2017-08-31 18:27:47 +0000 |
commit | 13d2beb14d0eceb9421bf3a8f4ea761e6afcef09 (patch) | |
tree | dc305ee096c12410153171b735866d3487b9b78f /llvm/test/Transforms/ObjCARC | |
parent | a6fc06babc7e0b057ee32b17eb350678038c3736 (diff) | |
download | bcm5719-llvm-13d2beb14d0eceb9421bf3a8f4ea761e6afcef09.tar.gz bcm5719-llvm-13d2beb14d0eceb9421bf3a8f4ea761e6afcef09.zip |
[ObjCARC] Pass the correct BasicBlock to fix assertion failure.
The BasicBlock passed to FindPredecessorRetainWithSafePath should be the
parent block of Autorelease. This fixes a crash that occurs in
FindDependencies when StartInst is not in StartBB.
rdar://problem/33866381
llvm-svn: 312266
Diffstat (limited to 'llvm/test/Transforms/ObjCARC')
-rw-r--r-- | llvm/test/Transforms/ObjCARC/rv.ll | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/llvm/test/Transforms/ObjCARC/rv.ll b/llvm/test/Transforms/ObjCARC/rv.ll index e99ba92dc45..d84a875684f 100644 --- a/llvm/test/Transforms/ObjCARC/rv.ll +++ b/llvm/test/Transforms/ObjCARC/rv.ll @@ -314,6 +314,25 @@ define void @test25() { ret void } +; Check that ObjCARCOpt::OptimizeReturns removes the redundant calls even when +; they are not in the same basic block. This code used to cause an assertion +; failure. + +; CHECK-LABEL: define i8* @test26() +; CHECK: call i8* @returner() +; CHECK-NOT: call +define i8* @test26() { +bb0: + %v0 = call i8* @returner() + %v1 = tail call i8* @objc_retain(i8* %v0) + br label %bb1 +bb1: + %v2 = tail call i8* @objc_autoreleaseReturnValue(i8* %v1) + br label %bb2 +bb2: + ret i8* %v2 +} + !0 = !{} ; CHECK: attributes [[NUW]] = { nounwind } |