Change EmitBranch to always clear the insert point to clarify irgen

invariants.

llvm-svn: 59085
This commit is contained in:
Daniel Dunbar 2008-11-11 22:06:59 +00:00
parent 8cbbcb1f2f
commit ab197ebb1a
2 changed files with 6 additions and 1 deletions

View File

@ -168,11 +168,12 @@ void CodeGenFunction::EmitBranch(llvm::BasicBlock *Target) {
// If the last block was an empty placeholder, remove it now.
// TODO: cache and reuse these.
CurBB->eraseFromParent();
Builder.ClearInsertionPoint();
} else {
// Otherwise, create a fall-through branch.
Builder.CreateBr(Target);
}
Builder.ClearInsertionPoint();
}
void CodeGenFunction::EmitDummyBlock() {

View File

@ -229,6 +229,10 @@ public:
/// EmitBranch - Emit a branch to the specified basic block from the
/// current insert block, taking care to avoid creation of branches
/// from dummy blocks.
///
/// This function clears the current insertion point. The caller
/// should follow calls to this function with calls to Emit*Block
/// prior to generation new code.
void EmitBranch(llvm::BasicBlock *Block);
/// EmitDummyBlock - Emit a new block which will never be branched