aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2008-11-13 01:24:05 +0000
committerDaniel Dunbar <daniel@zuster.org>2008-11-13 01:24:05 +0000
commita0c21a8faa79e88ac432d116eca58f7a7217195d (patch)
tree257f42b5566619c0b2f41e68be30b896eeaeff08 /lib/CodeGen/CGStmt.cpp
parent24a581586400bce6dbaa9fd5b6eb6e6ad5aae9fe (diff)
Add IsFinished arg to EmitBlock.
- Indicates that caller is done with the block and it can be dropped if it has no predecessors. Useful for callers who need to make landing pads but which may not be reached. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59207 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r--lib/CodeGen/CGStmt.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp
index a66b6fec04..ad081c91f7 100644
--- a/lib/CodeGen/CGStmt.cpp
+++ b/lib/CodeGen/CGStmt.cpp
@@ -157,9 +157,15 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast,
return EmitAnyExpr(cast<Expr>(LastStmt), AggLoc);
}
-void CodeGenFunction::EmitBlock(llvm::BasicBlock *BB) {
+void CodeGenFunction::EmitBlock(llvm::BasicBlock *BB, bool IsFinished) {
// Fall out of the current block (if necessary).
EmitBranch(BB);
+
+ if (IsFinished && BB->use_empty()) {
+ delete BB;
+ return;
+ }
+
CurFn->getBasicBlockList().push_back(BB);
Builder.SetInsertPoint(BB);
}