This is an archive of the discontinued LLVM Phabricator instance.

[LLDB] Optimize lldb build time and memory consumption.
Needs ReviewPublic

Authored by Emmmer on Oct 30 2022, 11:02 AM.

Details

Summary

After land D136362, we found that:

On Loongarch, g++ is killed by the OOM-killer due to using too many resources, while clang++ is not.

I suspect the cause is that g++ tries to instantiate these generic lambdas inside std::visit(), which consumes N^2 the size memory when there's nested-std::visit()

It could cause a potential build error since the RISCVInst contains more and more Insts. (It means N will increase.)

So I tried to overload operator== to replace use std::visit(), here are my codes and results.

Diff Detail

Event Timeline

Emmmer created this revision.Oct 30 2022, 11:02 AM
Emmmer requested review of this revision.Oct 30 2022, 11:02 AM

Thank you for your patch.
It seems there is a new problem with this patch.

You can test it on x86_64 like this:
https://reviews.llvm.org/D136362#3895385

Please mention the tools version in the commit somewhere "memory consumption when using gcc 13". If one of you could file a bug at https://gcc.gnu.org/bugzilla/, then you can reference that also.

13 is not released yet so there is a chance to get it fixed before now, if that doesn't happen, having the release number in the commit will explain why things are done the way they are.

c++: fatal error: Killed signal terminated program cc1plus due to out of memory
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107483

@SixWeining, @xry111, @xen0n
please take a look if you are intrested.

xen0n added a reviewer: xen0n.Oct 31 2022, 7:42 PM

Thanks for the heads-up @seehearfeel!

For now I believe it's more beneficial to fix the problem in gcc-13. Not only because it's shown to be a memory usage regression from gcc-12 by @seehearfeel in the GCC bug, but also fixing it there benefits more projects than LLVM/LLDB alone.

Let's wait for resolution of the gcc bug then revisit this; the refactoring here may prove useful independent of the gcc bug worked around here.