[cfe-commits] r76365 - /cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Daniel Dunbar daniel at zuster.org
Sun Jul 19 01:24:34 PDT 2009


Author: ddunbar
Date: Sun Jul 19 03:24:34 2009
New Revision: 76365

URL: http://llvm.org/viewvc/llvm-project?rev=76365&view=rev
Log:
Catch another trivial case where we can avoid emitting a separate return blcok.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=76365&r1=76364&r2=76365&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Sun Jul 19 03:24:34 2009
@@ -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;
   }





More information about the cfe-commits mailing list