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

Anders Carlsson andersca at mac.com
Sat May 30 17:33:20 PDT 2009


Author: andersca
Date: Sat May 30 19:33:20 2009
New Revision: 72654

URL: http://llvm.org/viewvc/llvm-project?rev=72654&view=rev
Log:
When possible, don't emit the cleanup block. Instead, just move the instructions to the current block.

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=72654&r1=72653&r2=72654&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Sat May 30 19:33:20 2009
@@ -652,7 +652,13 @@
 {
   CleanupBlockInfo Info = PopCleanupBlock();
   
-  EmitBlock(Info.CleanupBlock);
+  llvm::BasicBlock *CurBB = Builder.GetInsertBlock();
+  if (CurBB && !CurBB->getTerminator() && 
+      Info.CleanupBlock->getNumUses() == 0) {
+    CurBB->getInstList().splice(CurBB->end(), Info.CleanupBlock->getInstList());
+    delete Info.CleanupBlock;
+  } else 
+    EmitBlock(Info.CleanupBlock);
   
   if (Info.SwitchBlock)
     EmitBlock(Info.SwitchBlock);





More information about the cfe-commits mailing list