diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-11-11 22:06:59 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-11-11 22:06:59 +0000 |
commit | ab197ebb1abe6cad99fc10fabca00740dff91529 (patch) | |
tree | 7923900eec1f0cfd1a0a46a5971f73cc19e649fc | |
parent | 8cbbcb1f2ff735ca8e71d7208c5bd1de813b5aed (diff) | |
download | bcm5719-llvm-ab197ebb1abe6cad99fc10fabca00740dff91529.tar.gz bcm5719-llvm-ab197ebb1abe6cad99fc10fabca00740dff91529.zip |
Change EmitBranch to always clear the insert point to clarify irgen
invariants.
llvm-svn: 59085
-rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 3 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index f2088f416d5..97a7a057687 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -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() { diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index d482086e1a1..b833380e49a 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -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 |