Skip to content

Commit

Permalink
Basic blocks typically have few predecessors. Use a SmallDenseMap to
Browse files Browse the repository at this point in the history
avoid a heap allocation when this is the case.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@192602 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
lattner committed Oct 14, 2013
1 parent 9586430 commit 2a6cbba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Transforms/Utils/SSAUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void SSAUpdater::AddAvailableValue(BasicBlock *BB, Value *V) {
}

static bool IsEquivalentPHI(PHINode *PHI,
DenseMap<BasicBlock*, Value*> &ValueMapping) {
SmallDenseMap<BasicBlock*, Value*, 8> &ValueMapping) {
unsigned PHINumValues = PHI->getNumIncomingValues();
if (PHINumValues != ValueMapping.size())
return false;
Expand Down Expand Up @@ -136,8 +136,8 @@ Value *SSAUpdater::GetValueInMiddleOfBlock(BasicBlock *BB) {
// Otherwise, we do need a PHI: check to see if we already have one available
// in this block that produces the right value.
if (isa<PHINode>(BB->begin())) {
DenseMap<BasicBlock*, Value*> ValueMapping(PredValues.begin(),
PredValues.end());
SmallDenseMap<BasicBlock*, Value*, 8> ValueMapping(PredValues.begin(),
PredValues.end());
PHINode *SomePHI;
for (BasicBlock::iterator It = BB->begin();
(SomePHI = dyn_cast<PHINode>(It)); ++It) {
Expand Down

0 comments on commit 2a6cbba

Please sign in to comment.