[PATCH] D28005: Add a unit field to DIGlobalVariable, mirroring the design of DISubprogram.

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 17:14:17 PST 2016


> On Dec 20, 2016, at 4:24 PM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> Based on the discussion about DISubprogram deduplication for inline functions in (all flavors of) LTO - could we make this unit link null for non-external (well, specifically globals that can be duplicated - linkonce_odr and the like) & just emit those into whichever CU references them first?

At first I was concerned that this would restrict the visibility of that global variable in a debugger session also to just that one random CU, but that is not actually the case. We also don't emit any debug info for extern declarations and the debugger can still find them as long as they are defined in some other CU as DW_AT_external.

> This would avoid redundant descriptions (where all but one lacks any location description, etc) of deduplicable globals. Though perhaps it's a non-issue for globals, since they aren't inlined - but they could be reduced to a constant which is sort of the same.
> 
> I can explain/provide examples if I'm being vague/hand-wavy.

I'll give it a try. If I can find a way to support this in the famous three DwarfDebug loops without reintroducing the Processed set, I'll incorporate this into the next revision.

-- adrian


More information about the llvm-commits mailing list