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 | ea3060a9e5d426de79ad58b9c98091bb8bdd0faa (patch) | |
tree | 2d0dc9cc8eb8bf28ea7ea015dcc7aec6bafa4373 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | c3ab4c6c987a6351c2130b09190b19f836fd2a54 (diff) | |
download | bcm5719-llvm-ea3060a9e5d426de79ad58b9c98091bb8bdd0faa.tar.gz bcm5719-llvm-ea3060a9e5d426de79ad58b9c98091bb8bdd0faa.zip |
Catch another trivial case where we can avoid emitting a separate return blcok.
llvm-svn: 76365
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index e41476e6503..2050d12e466 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/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; } |