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

Evan Cheng evan.cheng at apple.com
Fri Jun 27 00:22:55 PDT 2008


32 is a fairly nice sized set. Is this always a win? Perhaps we can  
make the set an instance variable and share it among several functions?

Evan

On Jun 27, 2008, at 12:05 AM, Owen Anderson wrote:

> 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)
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list