[llvm-commits] [llvm] r122803 - /llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

Cameron Zwarich zwarich at apple.com
Mon Jan 3 22:42:27 PST 2011


Author: zwarich
Date: Tue Jan  4 00:42:27 2011
New Revision: 122803

URL: http://llvm.org/viewvc/llvm-project?rev=122803&view=rev
Log:
Eliminate repeated allocation of a per-BB DenseMap for a 4.6% reduction of time
spent in StrongPHIElimination on 403.gcc.

Modified:
    llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp

Modified: llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp?rev=122803&r1=122802&r2=122803&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp (original)
+++ llvm/trunk/lib/CodeGen/StrongPHIElimination.cpp Tue Jan  4 00:42:27 2011
@@ -144,6 +144,10 @@
     // 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 @@
   // 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) {





More information about the llvm-commits mailing list