aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore
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
commitf2c3106866137b0c06e99f453a83d9558c0c6934 (patch)
treeda7809128b7baa1545dd2f69ce6a5ddca44b904e /lib/VMCore
parent6a8c2907b0721ce53ad6887be5b10eef50dac060 (diff)
downloadexternal_llvm-f2c3106866137b0c06e99f453a83d9558c0c6934.zip
external_llvm-f2c3106866137b0c06e99f453a83d9558c0c6934.tar.gz
external_llvm-f2c3106866137b0c06e99f453a83d9558c0c6934.tar.bz2
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. :) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11105 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore')
-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 f2b551b..c83b316 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);