[llvm-commits] Avoid O(#registers*#basicblocks) memory use in LiveVariables
Evan Cheng
evan.cheng at apple.com
Fri May 22 17:10:07 PDT 2009
On May 22, 2009, at 4:37 PM, Jeffrey Yasskin wrote:
> I just wanted to double-check that you're not worried about the extra
> memory use for small functions, and the potential for quadratic time
> with a higher constant, before I commit this.
I can see the potential for both of those issues. Perhaps you can
specialize SparseBitVector with a smaller element size to reduce
memory usage? As for compile time cost, can you measure it by return
through the llvm test suite?
Thanks,
Evan
>
> On Fri, May 22, 2009 at 4:03 PM, Evan Cheng <evan.cheng at apple.com>
> wrote:
>> 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
>>
>> _______________________________________________
>> 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
More information about the llvm-commits
mailing list