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
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index e41476e..2050d12 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -82,11 +82,12 @@
   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;
   }