DebugInfo: Don't allow type units to references types in the CU
authorDavid Blaikie <dblaikie@gmail.com>
Fri, 25 Mar 2022 22:42:41 +0000 (22:42 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Fri, 25 Mar 2022 23:49:03 +0000 (23:49 +0000)
commita5032b26337bc7d877c3ab4e7f18265a3c044df9
treed0ff0e7d72bdf66bd83a66be71d16e34fbe6954f
parent16eaa5240e30af36a91db387df3c2effff83e742
DebugInfo: Don't allow type units to references types in the CU

We could only do this in limited ways (since we emit the TUs first, we
can't use ref_addr (& we can't use that in Split DWARF either) - so we
had to synthesize declarations into the TUs) and they were ambiguous in
some cases (if the CU type had internal linkage, parsing the TU would
require knowing which CU was referencing the TU to know which type the
declaration was for, which seems not-ideal). So to avoid all that, let's
just not reference types defined in the CU from TUs - instead moving the
TU type into the CU (recursively).

This does increase debug info size (by pulling more things out of type
units, into the compile unit) - about 2% of uncompressed dwp file size
for clang -O0 -g -gsplit-dwarf. (5% .debug_info.dwo section size
increase in the .dwp)
cross-project-tests/debuginfo-tests/clang_llvm_roundtrip/simplified_template_names.cpp
llvm/lib/CodeGen/AsmPrinter/AddressPool.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/test/DebugInfo/X86/addr-tu-to-non-tu.ll
llvm/test/DebugInfo/X86/tu-to-non-tu.ll