aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/BasicBlock.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/BasicBlock.cpp')
-rw-r--r--lib/VMCore/BasicBlock.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp
index f2b551bbd9..c83b316672 100644
--- a/lib/VMCore/BasicBlock.cpp
+++ b/lib/VMCore/BasicBlock.cpp
@@ -233,14 +233,9 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const std::string &BBName) {
BasicBlock *New = new BasicBlock(BBName, getParent());
- // Go from the end of the basic block through to the iterator pointer, moving
- // to the new basic block...
- Instruction *Inst = 0;
- do {
- iterator EndIt = end();
- Inst = InstList.remove(--EndIt); // Remove from end
- New->InstList.push_front(Inst); // Add to front
- } while (Inst != &*I); // Loop until we move the specified instruction.
+ // Move all of the specified instructions from the original basic block into
+ // the new basic block.
+ New->getInstList().splice(New->end(), this->getInstList(), I, end());
// Add a branch instruction to the newly formed basic block.
new BranchInst(New, this);