[llvm-commits] Avoid O(#registers*#basicblocks) memory use in LiveVariables

Evan Cheng evan.cheng at apple.com
Mon May 25 22:59:50 PDT 2009


On May 25, 2009, at 9:33 PM, Chris Lattner wrote:

>
> On May 22, 2009, at 3:41 PM, Jeffrey Yasskin wrote:
>
>> LiveVariables::VarInfo contains two BitVectors, AliveBlocks and
>> UsedBlocks, which have as many entries as there are basic blocks in
>> the function. I believe LiveVariables::getVarInfo creates a VarInfo
>> struct for every register in the function, leading to quadratic space
>> use. On a particular function with approximately 30k basic blocks and
>> 280k instructions, which I've uploaded to
>> http://jeffrey.yasskin.info/dump/big_module.bc.bz2, this took
>> approximately 1.6GB of memory to codegen. The attached patch changes
>> these two variables to SparseBitVectors, which makes the memory use  
>> go
>> down to ~420MB (on Mac; llc on linux goes from 1.6GB->~900MB).
>
> I don't have any specific comment on this patch, but I will raise  
> the bigger issue: having a bitmap like this is insanity :).  Evan/ 
> Owen, what do you think the long term solution is for this? Can we  
> eliminate this bitmap entirely from livevariables by using dominance  
> based techniques, or build live intervals directly instead of  
> building live variables?  What is the client of this info?

Actually "UsedBlocks" can be eliminated today. It's not used any more  
as far as I can tell. As far "AliveBlocks", it's used by  
liveintervalanalysis and phi elimination. I believe LiveVariables can  
be eliminated by moving to dominance based technique. Certainly  
strongphielim does not make use of LiveVariables at all.

Evan

>
>
> -Chris




More information about the llvm-commits mailing list