[PATCH] D115325: [DWARF] Fix PR51087 Extraneous enum record in DWARF with type units
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 4 09:44:55 PST 2022
dblaikie added a comment.
In D115325#3219926 <https://reviews.llvm.org/D115325#3219926>, @Orlando wrote:
> Thanks very much for the reproducer and revert @dblaikie.
>
> IIUC it looks like this comment in `addGlobalTypeUnitType` in llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp hints at the issue (which was adding in your patch a0e3c751874f):
>
> // Insert, allowing the entry to remain as-is if it's already present
> // This way the CU-level type DIE is preferred over the "can't describe this
> // type as a unit offset because it's not really in the CU at all, it's only
> // in a type unit"
>
> Prior to my patch, the first call to `addGlobalTypeUnitType` would always be with the CU DIE. With my patch that is not always true (and sometimes there is no CU DIE at all).
>
> I'm not particularly familiar with pubnames/types, so I'm not sure which of the options I think we have is better/more appropriate:
>
> 1. Always emit CU DIEs for unused type unit types when pubtypes will be emitted (i.e., if we are emitting a pubtypes section then this patch will have no effect).
> 2. Or, don't emit a pubtype entry for a type that doesn't have a CU DIE (for example, with this patch applied, an unused enum which is described by a type unit).
>
> Or perhaps something else. What do you think?
Hrm :/ I'm not super enthusiastic about either direction. I'm starting to wonder whether this general direction is viable - that some DWARF consumers might not find types that are in type units but aren't referenced from the CUs at all.
Do you have a measure of the debug info size improvement of this direction? If it doesn't end up counting for much, maybe it's not worth trying to create this possibly novel debug info?
Do you know/could you look to see if there's any case where GCC produces type units without skeleton types that reference them? If there are such cases, that'd be reassuring, and may also help inform how we should behave with pubnames etc.
& have you tested this sort of DWARF (TUs without skeleton type references) with GDB and LLDB, do they seem to find the types well?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115325/new/
https://reviews.llvm.org/D115325
More information about the llvm-commits
mailing list