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

Owen Anderson resistor at mac.com
Fri Jun 27 00:29:15 PDT 2008


Having replaced the std::set with the SmallSet, I no longer see  
anything related to the set in profiling, so I doubt there's much  
benefit to be had from reusing it.  32 just seemed like a reasonable  
number.  Feel free to tune it if you'd like.

--Owen

On Jun 27, 2008, at 12:22 AM, Evan Cheng wrote:

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4260 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20080627/36d8b3fd/attachment.bin>


More information about the llvm-commits mailing list