<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>3GB memory reduction for xalan built with lto -g (without removing DIE duplication, the memory usage is 7GB)</div>
</div></div></div></blockquote><div><br></div></div><div>OK, so you're looking at memory usage during LTO, not the size of the resulting debug info? (that's fine, just trying to understand exactly what metrics you're targeting)</div>
</div></div></div></blockquote><div><br></div><div>One thought I had (and just discussed with Eric - he seemed to think it was plausible, at least):<br><br>If you're interested in reducing peak memory usage of LLVM during LTO, have you considered modifying debug info generation not to cache all the compile_units before emitting them? If we emitted one CU at a time as they were created I imagine the memory footprint would be much lower.<br>
<br>(and we could still, potentially, add the type cross-referencing by just caching the section offsets or labels, etc, of the types emitted in prior units - though that wouldn't be perfect for types that contain some members (implicit special members) in one CU and a different set of members in another CU (and it'll be a bit trickier for type units - we'd need to cache any subgraph of potentially self-referencing type units until all the signatures are resolved, then they could all be emitted))<br>
<br>This isn't necessarily a place you should start with - I can appreciate that your current approach is probably higher value to you for lower engineering cost (and thus gets you closer sooner) but if it's still not going to be sufficient for your needs, especially if you're going to have to implement something like emit-CU-at-a-time as I describe above anyway, it might be more valuable to lay that foundation first.<br>
<br>If not, I'd still probably like to discuss the design of the cross-CU referencing work you have here to decide on the right design in a normal patch review process rather than trying to think about how the current code can be morphed into a better design.<br>
<br>- David <br></div></div></div></div>