[llvm-commits] CVS: llvm/lib/CodeGen/PHIElimination.cpp
Chris Lattner
lattner at cs.uiuc.edu
Mon May 10 14:17:02 PDT 2004
Changes in directory llvm/lib/CodeGen:
PHIElimination.cpp updated: 1.24 -> 1.25
---
Log message:
Switch this from using an std::map to using a DenseMap. This speeds up
phi-elimination from 0.6 to 0.54s on kc++.
---
Diffs of the changes: (+5 -6)
Index: llvm/lib/CodeGen/PHIElimination.cpp
diff -u llvm/lib/CodeGen/PHIElimination.cpp:1.24 llvm/lib/CodeGen/PHIElimination.cpp:1.25
--- llvm/lib/CodeGen/PHIElimination.cpp:1.24 Mon May 10 14:06:37 2004
+++ llvm/lib/CodeGen/PHIElimination.cpp Mon May 10 14:17:36 2004
@@ -20,6 +20,7 @@
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.h"
+#include "Support/DenseMap.h"
#include "Support/STLExtras.h"
using namespace llvm;
@@ -70,7 +71,8 @@
// VRegPHIUseCount - Keep track of the number of times each virtual register
// is used by PHI nodes in this block.
- std::map<unsigned, unsigned> VRegPHIUseCount;
+ DenseMap<unsigned, VirtReg2IndexFunctor> VRegPHIUseCount;
+ VRegPHIUseCount.grow(MF.getSSARegMap()->getLastVirtReg());
// Get an iterator to the first instruction after the last PHI node (this may
// allso be the end of the basic block). While we are scanning the PHIs,
@@ -231,11 +233,8 @@
}
// Is it used by any PHI instructions in this block?
- if (!ValueIsLive) {
- std::map<unsigned,unsigned>::iterator I =
- VRegPHIUseCount.find(SrcReg);
- ValueIsLive = I != VRegPHIUseCount.end() && I->second;
- }
+ if (!ValueIsLive)
+ ValueIsLive = VRegPHIUseCount[SrcReg] != 0;
}
// Okay, if we now know that the value is not live out of the block,
More information about the llvm-commits
mailing list