switch DominanceFrontier::splitBlock to use a smallvector for

the pred list instead of a vector, saving a boat load of malloc/free's.

llvm-svn: 79062
This commit is contained in:
Chris Lattner 2009-08-15 01:39:28 +00:00
parent 0700a56860
commit b1bf2009a4
1 changed files with 2 additions and 2 deletions

View File

@ -76,7 +76,7 @@ void DominanceFrontier::splitBlock(BasicBlock *NewBB) {
&& "NewBB should have a single successor!"); && "NewBB should have a single successor!");
BasicBlock *NewBBSucc = NewBB->getTerminator()->getSuccessor(0); BasicBlock *NewBBSucc = NewBB->getTerminator()->getSuccessor(0);
std::vector<BasicBlock*> PredBlocks; SmallVector<BasicBlock*, 8> PredBlocks;
for (pred_iterator PI = pred_begin(NewBB), PE = pred_end(NewBB); for (pred_iterator PI = pred_begin(NewBB), PE = pred_end(NewBB);
PI != PE; ++PI) PI != PE; ++PI)
PredBlocks.push_back(*PI); PredBlocks.push_back(*PI);
@ -153,7 +153,7 @@ void DominanceFrontier::splitBlock(BasicBlock *NewBB) {
// Verify whether this block dominates a block in predblocks. If not, do // Verify whether this block dominates a block in predblocks. If not, do
// not update it. // not update it.
bool BlockDominatesAny = false; bool BlockDominatesAny = false;
for (std::vector<BasicBlock*>::const_iterator BI = PredBlocks.begin(), for (SmallVectorImpl<BasicBlock*>::const_iterator BI = PredBlocks.begin(),
BE = PredBlocks.end(); BI != BE; ++BI) { BE = PredBlocks.end(); BI != BE; ++BI) {
if (DT.dominates(FI, *BI)) { if (DT.dominates(FI, *BI)) {
BlockDominatesAny = true; BlockDominatesAny = true;