When poking at some dwarf bugs, which were ultimately fixed by Richard,
I made a couple of cleanups. The first two are pretty obvious comment
clarification, but the last fragment is a more invasive control flow
change. In that case we essentially repeat an inline-static-var check
in two places. I've replaced that with a bool to control whether we
should splice. That at least helped me understand the code better, and
should give the optimizer better visibility to simplify the generated
control flow.
tested on x86_64-linux, ok?
nathan
--
Nathan Sidwell
2019-05-10 Nathan Sidwell <nat...@acm.org>
* dwarf2out.c (breakout_comdat_types): Move comment to correct
piece of code.
(const_ok_for_output_1): Balance parens around #if/#else/#endif
(gen_member_die): Move abstract origin check earlier. Only VARs
can be static_inline_p. Simplify splicing control flow.
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 271062)
+++ dwarf2out.c (working copy)
@@ -8576,11 +8576,12 @@ break_out_comdat_types (dw_die_ref die)
/* Break out nested types into their own type units. */
break_out_comdat_types (c);
- /* Create a new type unit DIE as the root for the new tree, and
- add it to the list of comdat types. */
+ /* Create a new type unit DIE as the root for the new tree. */
unit = new_die (DW_TAG_type_unit, NULL, NULL);
add_AT_unsigned (unit, DW_AT_language,
get_AT_unsigned (comp_unit_die (), DW_AT_language));
+
+ /* Add the new unit's type DIE into the comdat type list. */
type_node = ggc_cleared_alloc<comdat_type_node> ();
type_node->root_die = unit;
type_node->next = comdat_type_list;
@@ -14509,11 +14510,10 @@ const_ok_for_output_1 (rtx rtl)
"non-delegitimized UNSPEC %s (%d) found in variable location",
((XINT (rtl, 1) >= 0 && XINT (rtl, 1) < NUM_UNSPEC_VALUES)
? unspec_strings[XINT (rtl, 1)] : "unknown"),
- XINT (rtl, 1));
#else
"non-delegitimized UNSPEC %d found in variable location",
- XINT (rtl, 1));
#endif
+ XINT (rtl, 1));
expansion_failed (NULL_TREE, rtl,
"UNSPEC hasn't been delegitimized.\n");
return false;
@@ -25161,19 +25161,20 @@ gen_member_die (tree type, dw_die_ref co
context_die);
}
- /* Now output info about the data members and type members. */
+ /* Now output info about the members. */
for (member = TYPE_FIELDS (type); member; member = DECL_CHAIN (member))
{
+ /* Ignore clones. */
+ if (DECL_ABSTRACT_ORIGIN (member))
+ continue;
+
struct vlr_context vlr_ctx = { type, NULL_TREE };
bool static_inline_p
- = (TREE_STATIC (member)
+ = (VAR_P (member)
+ && TREE_STATIC (member)
&& (lang_hooks.decls.decl_dwarf_attribute (member, DW_AT_inline)
!= -1));
- /* Ignore clones. */
- if (DECL_ABSTRACT_ORIGIN (member))
- continue;
-
/* If we thought we were generating minimal debug info for TYPE
and then changed our minds, some of the member declarations
may have already been defined. Don't define them again, but
@@ -25183,11 +25184,14 @@ gen_member_die (tree type, dw_die_ref co
{
/* Handle inline static data members, which only have in-class
declarations. */
- dw_die_ref ref = NULL;
+ bool splice = true;
+
+ dw_die_ref ref = NULL;
if (child->die_tag == DW_TAG_variable
&& child->die_parent == comp_unit_die ())
{
ref = get_AT_ref (child, DW_AT_specification);
+
/* For C++17 inline static data members followed by redundant
out of class redeclaration, we might get here with
child being the DIE created for the out of class
@@ -25206,17 +25210,17 @@ gen_member_die (tree type, dw_die_ref co
ref = NULL;
static_inline_p = false;
}
- }
- if (child->die_tag == DW_TAG_variable
- && child->die_parent == comp_unit_die ()
- && ref == NULL)
- {
- reparent_child (child, context_die);
- if (dwarf_version < 5)
- child->die_tag = DW_TAG_member;
+ if (!ref)
+ {
+ reparent_child (child, context_die);
+ if (dwarf_version < 5)
+ child->die_tag = DW_TAG_member;
+ splice = false;
+ }
}
- else
+
+ if (splice)
splice_child_die (context_die, child);
}