diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-19 08:24:34 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-19 08:24:34 +0000 |
commit | 96e18b05ea6b55aa92a1a576f29e9cee73a7e20b (patch) | |
tree | 7f938e331c8fc6c48bcbd2c740ee1847b3a0843b /lib/CodeGen | |
parent | cd5e60e1d4093b9a757cc85e35fccc093f8f8527 (diff) |
Catch another trivial case where we can avoid emitting a separate return blcok.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76365 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index e41476e650..2050d12e46 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -82,11 +82,12 @@ void CodeGenFunction::EmitReturnBlock() { if (CurBB) { assert(!CurBB->getTerminator() && "Unexpected terminated block."); - // We have a valid insert point, reuse it if there are no explicit - // jumps to the return block. - if (ReturnBlock->use_empty()) + // We have a valid insert point, reuse it if it is empty or there are no + // explicit jumps to the return block. + if (CurBB->empty() || ReturnBlock->use_empty()) { + ReturnBlock->replaceAllUsesWith(CurBB); delete ReturnBlock; - else + } else EmitBlock(ReturnBlock); return; } |