aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCameron Zwarich <zwarich@apple.com>2011-01-04 06:42:27 +0000
committerCameron Zwarich <zwarich@apple.com>2011-01-04 06:42:27 +0000
commit645b1d2f12e6637840d3b118231f60b3a587073a (patch)
treee8611e76922d53bf15ffdae51e9d15139adceb06
parent95bb00414eba82cc1c058b558cd28bc28134c561 (diff)
Eliminate repeated allocation of a per-BB DenseMap for a 4.6% reduction of time
spent in StrongPHIElimination on 403.gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122803 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/StrongPHIElimination.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/CodeGen/StrongPHIElimination.cpp b/lib/CodeGen/StrongPHIElimination.cpp
index 91ec13df64..54c6647f05 100644
--- a/lib/CodeGen/StrongPHIElimination.cpp
+++ b/lib/CodeGen/StrongPHIElimination.cpp
@@ -144,6 +144,10 @@ namespace {
// sources.
DenseMap<MachineBasicBlock*, std::vector<MachineInstr*> > PHISrcDefs;
+ // Maps a color to a pair of a MachineInstr* and a virtual register, which
+ // is the operand of that PHI corresponding to the current basic block.
+ DenseMap<unsigned, std::pair<MachineInstr*, unsigned> > CurrentPHIForColor;
+
// FIXME: Can these two data structures be combined? Would a std::multimap
// be any better?
@@ -567,12 +571,7 @@ StrongPHIElimination::SplitInterferencesForBasicBlock(
// the predecessor block. The def of a PHI's destination register is processed
// along with the other defs in a basic block.
- // The map CurrentPHIForColor maps a color to a pair of a MachineInstr* and a
- // virtual register, which is the operand of that PHI corresponding to the
- // current basic block.
- // FIXME: This should use a container that doesn't always perform heap
- // allocation.
- DenseMap<unsigned, std::pair<MachineInstr*, unsigned> > CurrentPHIForColor;
+ CurrentPHIForColor.clear();
for (MachineBasicBlock::succ_iterator SI = MBB.succ_begin(),
SE = MBB.succ_end(); SI != SE; ++SI) {