Commit 775669c1 by Richard Biener Committed by Richard Biener

cgraphunit.c (analyze_functions): Set node->definition to false to signal symbol removal to...

2016-10-20  Richard Biener  <rguenther@suse.de>

	* cgraphunit.c (analyze_functions): Set node->definition to
	false to signal symbol removal to debug_hooks->late_global_decl.
	* ipa.c (symbol_table::remove_unreachable_nodes): When not in
	WPA signal symbol removal to the debuginfo machinery.
	* dwarf2out.c (dwarf2out_late_global_decl): Instead of
	using early_finised to guard the we're called for symbol
	removal case look at the symtabs definition flag.
	(gen_variable_die): Remove redundant check.

From-SVN: r241363
parent a65593a4
2016-10-20 Richard Biener <rguenther@suse.de>
* cgraphunit.c (analyze_functions): Set node->definition to
false to signal symbol removal to debug_hooks->late_global_decl.
* ipa.c (symbol_table::remove_unreachable_nodes): When not in
WPA signal symbol removal to the debuginfo machinery.
* dwarf2out.c (dwarf2out_late_global_decl): Instead of
using early_finised to guard the we're called for symbol
removal case look at the symtabs definition flag.
(gen_variable_die): Remove redundant check.
2016-10-20 Andreas Krebbel <krebbel@linux.vnet.ibm.com> 2016-10-20 Andreas Krebbel <krebbel@linux.vnet.ibm.com>
* config/s390/s390.md ("prefetch"): Add fallthrough comment. * config/s390/s390.md ("prefetch"): Add fallthrough comment.
......
...@@ -1208,6 +1208,7 @@ analyze_functions (bool first_time) ...@@ -1208,6 +1208,7 @@ analyze_functions (bool first_time)
so they effectively appear as readonly. Show that to so they effectively appear as readonly. Show that to
the debug machinery. */ the debug machinery. */
TREE_READONLY (node->decl) = 1; TREE_READONLY (node->decl) = 1;
node->definition = false;
(*debug_hooks->late_global_decl) (node->decl); (*debug_hooks->late_global_decl) (node->decl);
} }
......
...@@ -21264,7 +21264,6 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) ...@@ -21264,7 +21264,6 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
tree ultimate_origin; tree ultimate_origin;
dw_die_ref var_die; dw_die_ref var_die;
dw_die_ref old_die = decl ? lookup_decl_die (decl) : NULL; dw_die_ref old_die = decl ? lookup_decl_die (decl) : NULL;
dw_die_ref origin_die = NULL;
bool declaration = (DECL_EXTERNAL (decl_or_origin) bool declaration = (DECL_EXTERNAL (decl_or_origin)
|| class_or_namespace_scope_p (context_die)); || class_or_namespace_scope_p (context_die));
bool specialization_p = false; bool specialization_p = false;
...@@ -21424,7 +21423,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) ...@@ -21424,7 +21423,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
var_die = new_die (DW_TAG_variable, context_die, decl); var_die = new_die (DW_TAG_variable, context_die, decl);
if (origin != NULL) if (origin != NULL)
origin_die = add_abstract_origin_attribute (var_die, origin); add_abstract_origin_attribute (var_die, origin);
/* Loop unrolling can create multiple blocks that refer to the same /* Loop unrolling can create multiple blocks that refer to the same
static variable, so we must test for the DW_AT_declaration flag. static variable, so we must test for the DW_AT_declaration flag.
...@@ -21500,10 +21499,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) ...@@ -21500,10 +21499,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
already set. */ already set. */
|| (VAR_P (decl_or_origin) || (VAR_P (decl_or_origin)
&& TREE_STATIC (decl_or_origin) && TREE_STATIC (decl_or_origin)
&& DECL_RTL_SET_P (decl_or_origin))) && DECL_RTL_SET_P (decl_or_origin))))
/* When abstract origin already has DW_AT_location attribute, no need
to add it again. */
&& (origin_die == NULL || get_AT (origin_die, DW_AT_location) == NULL))
{ {
if (early_dwarf) if (early_dwarf)
add_pubname (decl_or_origin, var_die); add_pubname (decl_or_origin, var_die);
...@@ -23969,11 +23965,11 @@ dwarf2out_late_global_decl (tree decl) ...@@ -23969,11 +23965,11 @@ dwarf2out_late_global_decl (tree decl)
if (die) if (die)
{ {
/* We get called during the early debug phase via the symtab /* We get called via the symtab code invoking late_global_decl
code invoking late_global_decl for symbols that are optimized for symbols that are optimized out. Do not add locations
out. When the early phase is not finished, do not add for those. */
locations. */ varpool_node *node = varpool_node::get (decl);
if (! early_dwarf_finished) if (! node || ! node->definition)
tree_add_const_value_attribute_for_decl (die, decl); tree_add_const_value_attribute_for_decl (die, decl);
else else
add_location_or_const_value_attribute (die, decl, false); add_location_or_const_value_attribute (die, decl, false);
......
...@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
#include "ipa-prop.h" #include "ipa-prop.h"
#include "ipa-inline.h" #include "ipa-inline.h"
#include "dbgcnt.h" #include "dbgcnt.h"
#include "debug.h"
/* Return true when NODE has ADDR reference. */ /* Return true when NODE has ADDR reference. */
...@@ -622,6 +623,12 @@ symbol_table::remove_unreachable_nodes (FILE *file) ...@@ -622,6 +623,12 @@ symbol_table::remove_unreachable_nodes (FILE *file)
if (file) if (file)
fprintf (file, " %s/%i", vnode->name (), vnode->order); fprintf (file, " %s/%i", vnode->name (), vnode->order);
vnext = next_variable (vnode); vnext = next_variable (vnode);
/* Signal removal to the debug machinery. */
if (! flag_wpa)
{
vnode->definition = false;
(*debug_hooks->late_global_decl) (vnode->decl);
}
vnode->remove (); vnode->remove ();
changed = true; changed = true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment