[PATCH] D115325: [DWARF] Fix PR51087 Extraneous enum record in DWARF with type units
Orlando Cazalet-Hyams via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 8 02:00:01 PST 2021
Orlando created this revision.
Orlando added reviewers: dblaikie, probinson, jmorse, ellis, krisb.
Orlando added projects: LLVM, debug-info.
Herald added a subscriber: hiraditya.
Orlando requested review of this revision.
Herald added a subscriber: llvm-commits.
Fixes https://llvm.org/PR51087: Extraneous enum record in DWARF with type units.
As explained in PR51087 we sometimes get skeleton DIEs for enums in a Dwarf
Compile Unit (CU) that are not referenced from any CU and are already described
by a type unit.
Types for enums are emitted whether used or not, all together before most types
in the CU. Mechanically, the extraneous CU records are generated because the
enum types are generated with a call to CU->getOrCreateTypeDIE. This function
will recursively get-or-create the parent DIE (in the CU) and the type unit for
each. We don't need the CU-side DIEs if the type units are sucesfully
emitted. Fix by only emitting the type units for enums if possible, falling back
to a call to getOrCreateTypeDIE if not.
https://reviews.llvm.org/D115325
Files:
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/test/DebugInfo/X86/type-units-unused-nested-enums.mir
llvm/test/DebugInfo/X86/type-units-used-enum.mir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115325.392682.patch
Type: text/x-patch
Size: 12030 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211208/ddaaf416/attachment.bin>
More information about the llvm-commits
mailing list