summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/BasicBlock.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-02-03 23:11:21 +0000
committerChris Lattner <sabre@nondot.org>2004-02-03 23:11:21 +0000
commitc4c7ea5288a61a87605f22c351d3126165cb73ff (patch)
tree1a8a4e42a8d6dde4a20c202830608179b95a9449 /llvm/lib/VMCore/BasicBlock.cpp
parent135dcc024b812576882d8ab9b093bfb571dede8d (diff)
downloadbcm5719-llvm-c4c7ea5288a61a87605f22c351d3126165cb73ff.tar.gz
bcm5719-llvm-c4c7ea5288a61a87605f22c351d3126165cb73ff.zip
In BasicBlock::splitBasicBlock, just use islist::splice to move the instructions,
instead of a loop that is really inefficient with large basic blocks. This speeds up the inliner pass on the testcase in PR209 from 13.8s to 2.24s which still isn't exactly speedy, but is a lot better. :) llvm-svn: 11105
Diffstat (limited to 'llvm/lib/VMCore/BasicBlock.cpp')
-rw-r--r--llvm/lib/VMCore/BasicBlock.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp
index f2b551bbd90..c83b316672c 100644
--- a/llvm/lib/VMCore/BasicBlock.cpp
+++ b/llvm/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);
OpenPOWER on IntegriCloud