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

Chris Lattner clattner at apple.com
Mon May 25 21:33:40 PDT 2009


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?

-Chris



More information about the llvm-commits mailing list