diff options
author | John McCall <rjmccall@apple.com> | 2010-04-21 11:18:06 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-04-21 11:18:06 +0000 |
commit | 548ce5e78215a34f409d597bb2c1e9f897a8eda3 (patch) | |
tree | 66d3272f5c9ef5e9b9f4d05f657998e71e42a617 /lib/CodeGen/CGStmt.cpp | |
parent | 839cbaa004a24e8f1ea14db5ed76e3d25ed28996 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101998 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index eb861f4690..70cb1a2eca 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/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); |