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

Evan Cheng evan.cheng at apple.com
Fri May 22 16:03:20 PDT 2009


Excellent. Thanks!

Evan

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).
>
> It's possible that this patch merely trades quadratic space on rare
> large functions for larger space and quadratic time on more common
> small functions, but I don't know enough about how LiveVariables works
> to know.
>
> This passes LLVM's `make check`, except for the Frontend tests that
> never pass for me.
>
> Jeffrey
> <
> smaller_livevars.patch>_______________________________________________
> 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