summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-05-10 19:17:36 +0000
committerChris Lattner <sabre@nondot.org>2004-05-10 19:17:36 +0000
commit24f200ad7b3aed95ddcfc7eec6cdfacb17032af4 (patch)
tree390986dbe43fe4a217d4ad258a19c2b68e5c8dd1 /llvm/lib/CodeGen
parent39a1e0a33e7d416ddf9d5dd1f989b2d17731adcf (diff)
downloadbcm5719-llvm-24f200ad7b3aed95ddcfc7eec6cdfacb17032af4.tar.gz
bcm5719-llvm-24f200ad7b3aed95ddcfc7eec6cdfacb17032af4.zip
Switch this from using an std::map to using a DenseMap. This speeds up
phi-elimination from 0.6 to 0.54s on kc++. llvm-svn: 13454
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/PHIElimination.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/PHIElimination.cpp b/llvm/lib/CodeGen/PHIElimination.cpp
index 5457dedbf26..ba0c977aeba 100644
--- a/llvm/lib/CodeGen/PHIElimination.cpp
+++ b/llvm/lib/CodeGen/PHIElimination.cpp
@@ -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 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) {
// 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 @@ bool PNE::EliminatePHINodes(MachineFunction &MF, MachineBasicBlock &MBB) {
}
// 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,
OpenPOWER on IntegriCloud