summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmt.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-04-21 11:18:06 +0000
committerJohn McCall <rjmccall@apple.com>2010-04-21 11:18:06 +0000
commitbf814c79b61942b49a0e549a131da7d5d1e1005b (patch)
tree6e4299519ad005521dd372e77aefa4f43b589a85 /clang/lib/CodeGen/CGStmt.cpp
parente683359fc9925b16c3fea1487411ab859484dcfb (diff)
downloadbcm5719-llvm-bf814c79b61942b49a0e549a131da7d5d1e1005b.tar.gz
bcm5719-llvm-bf814c79b61942b49a0e549a131da7d5d1e1005b.zip
I failed to notice that my last patch wasn't doing as much as it could
because EmitBranch actually clears the insert point. This version actually accomplishes what I initially wanted. llvm-svn: 101998
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmt.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp
index eb861f46906..70cb1a2eca0 100644
--- a/clang/lib/CodeGen/CGStmt.cpp
+++ b/clang/lib/CodeGen/CGStmt.cpp
@@ -205,6 +205,8 @@ void CodeGenFunction::SimplifyForwardingBlocks(llvm::BasicBlock *BB) {
}
void CodeGenFunction::EmitBlock(llvm::BasicBlock *BB, bool IsFinished) {
+ llvm::BasicBlock *CurBB = Builder.GetInsertBlock();
+
// Fall out of the current block (if necessary).
EmitBranch(BB);
@@ -227,8 +229,8 @@ void CodeGenFunction::EmitBlock(llvm::BasicBlock *BB, bool IsFinished) {
// Place the block after the current block, if possible, or else at
// the end of the function.
- if (Builder.GetInsertBlock())
- CurFn->getBasicBlockList().insertAfter(Builder.GetInsertBlock(), BB);
+ if (CurBB && CurBB->getParent())
+ CurFn->getBasicBlockList().insertAfter(CurBB, BB);
else
CurFn->getBasicBlockList().push_back(BB);
Builder.SetInsertPoint(BB);
OpenPOWER on IntegriCloud