https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97718
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Using gdb 8.3.1 on openSUSE Leap 15.2 doesn't show the excessive memory use.
The only difference in readelf -w of the binary before/after the patch is
--- /tmp/a 2020-11-05 08:58:26.636803199 +0100
+++ /tmp/b 2020-11-05 08:58:29.912837061 +0100
@@ -280,7 +280,7 @@
<142> DW_AT_abstract_origin: <0x2f9>
<146> DW_AT_location : 1 byte block: 54 (DW_OP_reg4 (rsi))
<2><148>: Abbrev Number: 5 (DW_TAG_inlined_subroutine)
- <149> DW_AT_abstract_origin: <0x2df>
+ <149> DW_AT_abstract_origin: <0x119>
<14d> DW_AT_entry_pc : 0x4004e0
<155> DW_AT_GNU_entry_view: 0
<156> DW_AT_low_pc : 0x4004e0
@@ -756,7 +756,7 @@
DW_AT_location DW_FORM_exprloc
DW_AT value: 0 DW_FORM value: 0
5 DW_TAG_inlined_subroutine [has children]
- DW_AT_abstract_origin DW_FORM_ref_addr
+ DW_AT_abstract_origin DW_FORM_ref4
DW_AT_entry_pc DW_FORM_addr
DW_AT_GNU_entry_view DW_FORM_data1
DW_AT_low_pc DW_FORM_addr
unpatched the abstract origin directly refered to the abstract origin of the
now refered DIE:
<1><119>: Abbrev Number: 2 (DW_TAG_subprogram)
<11a> DW_AT_abstract_origin: <0x2df>
<11e> DW_AT_low_pc : 0x4004d0
<126> DW_AT_high_pc : 0x40
<12e> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<130> DW_AT_GNU_all_call_sites: 1
<130> DW_AT_sibling : <0x1ff>
...
<1><2df>: Abbrev Number: 9 (DW_TAG_subprogram)
<2e0> DW_AT_name : fn2
<2e4> DW_AT_decl_file : 1
<2e5> DW_AT_decl_line : 12
<2e6> DW_AT_decl_column : 1
<2e7> DW_AT_prototyped : 1
<2e7> DW_AT_type : <0x2ad>
<2eb> DW_AT_sibling : <0x304>
I guess we're splitting / re-inlining fn2 here. The way the patch has
an effect is via
static inline void
add_abstract_origin_attribute (dw_die_ref die, tree origin)
{
dw_die_ref origin_die = NULL;
/* For late LTO debug output we want to refer directly to the abstract
DIE in the early debug rather to the possibly existing concrete
instance and avoid creating that just for this purpose. */
sym_off_pair *desc;
if (in_lto_p
&& external_die_map
&& (desc = external_die_map->get (origin)))
{
add_AT_external_die_ref (die, DW_AT_abstract_origin,
desc->sym, desc->off);
return;
}
which previously made the direct reference to the early debug origin
even when a local DIE for it was already created.
We can fix this by unwrapping one level.
Now the interesting thing is that before the change we had
FAIL: gcc.dg/guality/pr54519-4.c -O2 -flto -fno-use-linker-plugin
-flto-partition=none -DPREVENT_OPTIMIZATION line 17 y == 25
FAIL: gcc.dg/guality/pr54519-4.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects -DPREVENT_OPTIMIZATION line 17 y == 25
while after it
FAIL: gcc.dg/guality/pr54519-4.c -O2 -flto -fno-use-linker-plugin
-flto-partition=none -DPREVENT_OPTIMIZATION line 22 y == 68
FAIL: gcc.dg/guality/pr54519-4.c -O2 -flto -fuse-linker-plugin
-fno-fat-lto-objects -DPREVENT_OPTIMIZATION line 22 y == 68
clearly the old DWARF was better so I'm going to restore it but sth in the
location list processing seems off ...