[LLVMdev] Proposal: release MDNodes for source modules (LTO+debug info)

Chandler Carruth chandlerc at google.com
Tue Nov 12 18:11:20 PST 2013


On Tue, Nov 12, 2013 at 6:07 PM, Manman Ren <manman.ren at gmail.com> wrote:

> Hi Chandler,
>
> I don't quite get why you think sharing is not buying us anything...
> It reduces the memory footprint of the source modules (there is sharing
> among the source modules) and the number of MDNodes created for the
> destination module (we do not need to re-create the MDNodes that can be
> shared).
>
> The amount of sharing may not be that much but it still exists.
>
> I had some experiments earlier on building clang with "-flto -g", if we
> dis-allow sharing between source modules and destination module, the memory
> footprint for MDNodes will increase by 15%.
>

So, in my naive view, we do something like the following:

0) load a source module
1) load another source module
2) merge the second module into the first
3) delete the second module
4) while there are more source modules, goto 1

This would mean that by not sharing the individual source module would use
15% more memory, but based on your OP numbers the final linked memory usage
should still be 40% smaller. That seems like an easy win with very low
complexity?

Perhaps I just am being naive about how the LTO step works or there are
other complications. I just wanted to make sure we considered the easy path
of the module owning the metadata before introducing something to walk all
metadata and delete unreachable bits.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131112/8bb66753/attachment.html>


More information about the llvm-dev mailing list