[LLVMdev] LiveVariables/LiveInterval on huge functions

Evan Cheng evan.cheng at apple.com
Mon Apr 14 00:22:40 PDT 2008

On Apr 13, 2008, at 1:28 PM, Török Edwin wrote:

> Hi,
> In PR2193 LiveVariables runs out of memory on a 512M limit, after
> processing 11557 basicblocks.
> VirtRegInfo has ~180000 entries with ~700 bytes each.
> If I give it more memory (1.5G) it runs out of memory in LiveInterval.

Some of the information kept by LiveVariables are somewhat redundant  
and can be removed. I think there was talk of folding much of its  
computation into LiveIntervalAnalysis. It's not clear whether that  
would make a difference without careful analysis.

It's not clear to me what to do about LiveInterval. It does keep a lot  
of information but it's all essential.

I suspect StrongPHIElimination may help the situation somewhat but  
again I can't guess its impact.

> I don't see any easy solution to reduce memory usage, but should we
> optimize such a huge function at once?
> If the function is over some reasonable limit (5k basic-blocks?) we
> could split it into smaller functions, and avoid
> these problems.

But what is the right limit? How do you estimate the limit given  
different host configuration? If you can make the decision earlier,  
than it can default to the local register allocator path which doesn't  
require LiveIntervalAnalysis.

> I am writing a pass to do this split at llvm IR level. What do you  
> think?

This functionality sounds useful, but I am not sure it's the *right*  
fix. We should definitely try harder to make codegen more scalable.  
But it's not a trivial problem.


> --Edwin
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

More information about the llvm-dev mailing list