summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-05-31 00:33:20 +0000
committerAnders Carlsson <andersca@mac.com>2009-05-31 00:33:20 +0000
commitf3f91cee43b3c7cce74a028c1af4783a7cb6fdc4 (patch)
tree4d4b8b8f0ca6bfb5b08fb0bda21d3f71b0fad2fa
parentc0092ad333ef6823ced088081713e28737380e59 (diff)
downloadbcm5719-llvm-f3f91cee43b3c7cce74a028c1af4783a7cb6fdc4.tar.gz
bcm5719-llvm-f3f91cee43b3c7cce74a028c1af4783a7cb6fdc4.zip
When possible, don't emit the cleanup block. Instead, just move the instructions to the current block.
llvm-svn: 72654
-rw-r--r--clang/lib/CodeGen/CodeGenFunction.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp
index 1a95e619157..672f6da502b 100644
--- a/clang/lib/CodeGen/CodeGenFunction.cpp
+++ b/clang/lib/CodeGen/CodeGenFunction.cpp
@@ -652,7 +652,13 @@ void CodeGenFunction::EmitCleanupBlock()
{
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);
OpenPOWER on IntegriCloud