[llvm-bugs] [Bug 51087] New: Extraneous enum record in DWARF with type units
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 14 06:38:43 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51087
Bug ID: 51087
Summary: Extraneous enum record in DWARF with type units
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Keywords: wrong-debug
Severity: normal
Priority: P
Component: Common Code Generator Code
Assignee: unassignedbugs at nondot.org
Reporter: jeremy.morse.llvm at gmail.com
CC: aprantl at apple.com, dblaikie at gmail.com,
llvm-bugs at lists.llvm.org, paul.robinson at am.sony.com
This PR is a summary of an interesting scenario I've run into, where using type
units increases binary size, although only compared to constructor homing
de-duplication of types. Take a look at this reproducer, compiled with the
following flags using main / ee8da6369225f4:
clang++ test.cpp -o test.o -c -g -O2 -fdebug-types-section -gdwarf-5
--------8<--------
class fudge {
public:
enum blah {
a = 1,
b = 2
};
blah baz;
fudge() { }
};
fudge bar;
-------->8--------
If you take a look with llvm-dwarfdump at the output file, there are type units
for "fudge" and "blah" as expected, and for the "bar variable:
0x0000001e: DW_TAG_variable
DW_AT_name ("bar")
DW_AT_type (0x00000029 "class ")
DW_AT_external (true)
DW_AT_decl_file ("test.cpp")
DW_AT_decl_line (13)
DW_AT_location (DW_OP_addrx 0x0)
0x00000029: DW_TAG_class_type
DW_AT_declaration (true)
DW_AT_signature (0x1c93e96b85e3f5c8)
0x00000032: DW_TAG_enumeration_type
DW_AT_declaration (true)
DW_AT_signature (0x9b7ed24ce9445148)
To me, the DW_TAG_enumeration_type in the class definition is unexpected, as
the "fudge" type unit completely describes the contents of the class. Nothing
in the DWARF refers to the enum type. To me, this seems like an inefficiency.
Not shown is the larger project I've looked at, where there are enough
redundant child-enum-DIEs and child-class-DIEs in each class DIE to add a few
Mb of .debug_info (out of ~160Mb of .debug_info). The net effect is that
running with "-Xclang -fuse-ctor-homing -fdebug-types-section" is larger than
just using "-Xclang -fuse-ctor-homing"
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210714/f4b1dace/attachment.html>
More information about the llvm-bugs
mailing list