mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-22 03:28:35 +00:00
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
This commit is contained in:
parent
328ad5236f
commit
1404b61b62
@ -233,14 +233,9 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const std::string &BBName) {
|
|||||||
|
|
||||||
BasicBlock *New = new BasicBlock(BBName, getParent());
|
BasicBlock *New = new BasicBlock(BBName, getParent());
|
||||||
|
|
||||||
// Go from the end of the basic block through to the iterator pointer, moving
|
// Move all of the specified instructions from the original basic block into
|
||||||
// to the new basic block...
|
// the new basic block.
|
||||||
Instruction *Inst = 0;
|
New->getInstList().splice(New->end(), this->getInstList(), I, end());
|
||||||
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.
|
|
||||||
|
|
||||||
// Add a branch instruction to the newly formed basic block.
|
// Add a branch instruction to the newly formed basic block.
|
||||||
new BranchInst(New, this);
|
new BranchInst(New, this);
|
||||||
|
Loading…
Reference in New Issue
Block a user