[llvm-commits] [llvm] r52819 - /llvm/trunk/lib/CodeGen/LiveVariables.cpp

Owen Anderson resistor at mac.com
Fri Jun 27 00:05:59 PDT 2008


Author: resistor
Date: Fri Jun 27 02:05:59 2008
New Revision: 52819

URL: http://llvm.org/viewvc/llvm-project?rev=52819&view=rev
Log:
Use a SmallSet when we can to reduce memory allocations.
This speeds up a particular testcase from 0.0302s to 0.0222s in LiveVariables.

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

Modified: llvm/trunk/lib/CodeGen/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LiveVariables.cpp?rev=52819&r1=52818&r2=52819&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/LiveVariables.cpp (original)
+++ llvm/trunk/lib/CodeGen/LiveVariables.cpp Fri Jun 27 02:05:59 2008
@@ -34,6 +34,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/ADT/DepthFirstIterator.h"
 #include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Config/alloca.h"
 #include <algorithm>
@@ -387,7 +388,7 @@
 
 void LiveVariables::HandlePhysRegDef(unsigned Reg, MachineInstr *MI) {
   // What parts of the register are previously defined?
-  std::set<unsigned> Live;
+  SmallSet<unsigned, 32> Live;
   if (PhysRegDef[Reg] || PhysRegUse[Reg]) {
     Live.insert(Reg);
     for (const unsigned *SS = TRI->getSubRegisters(Reg); *SS; ++SS)





More information about the llvm-commits mailing list