Commit a0a98fef by Jan Hubicka Committed by Jan Hubicka

varpool.c: Include pointer-set.h.

	* varpool.c: Include pointer-set.h.
	(varpool_remove_unreferenced_decls): Variables in other partitions
	will not be output; be however careful to not lose information
	about partitioning.

From-SVN: r207620
parent b7e85694
2014-02-07 Jan Hubicka <hubicka@ucw.cz> 2014-02-07 Jan Hubicka <hubicka@ucw.cz>
* varpool.c: Include pointer-set.h.
(varpool_remove_unreferenced_decls): Variables in other partitions
will not be output; be however careful to not lose information
about partitioning.
2014-02-07 Jan Hubicka <hubicka@ucw.cz>
* gimple-fold.c (gimple_get_virt_method_for_vtable): Do O(1) * gimple-fold.c (gimple_get_virt_method_for_vtable): Do O(1)
lookup in the vtable constructor. lookup in the vtable constructor.
......
...@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "output.h" #include "output.h"
#include "gimple-expr.h" #include "gimple-expr.h"
#include "flags.h" #include "flags.h"
#include "pointer-set.h"
/* List of hooks triggered on varpool_node events. */ /* List of hooks triggered on varpool_node events. */
struct varpool_node_hook_list { struct varpool_node_hook_list {
...@@ -262,7 +263,7 @@ ctor_for_folding (tree decl) ...@@ -262,7 +263,7 @@ ctor_for_folding (tree decl)
return error_mark_node; return error_mark_node;
/* Do not care about automatic variables. Those are never initialized /* Do not care about automatic variables. Those are never initialized
anyway, because gimplifier exapnds the code*/ anyway, because gimplifier exapnds the code. */
if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl)) if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
{ {
gcc_assert (!TREE_PUBLIC (decl)); gcc_assert (!TREE_PUBLIC (decl));
...@@ -486,6 +487,7 @@ varpool_remove_unreferenced_decls (void) ...@@ -486,6 +487,7 @@ varpool_remove_unreferenced_decls (void)
varpool_node *first = (varpool_node *)(void *)1; varpool_node *first = (varpool_node *)(void *)1;
int i; int i;
struct ipa_ref *ref; struct ipa_ref *ref;
struct pointer_set_t *referenced = pointer_set_create ();
if (seen_error ()) if (seen_error ())
return; return;
...@@ -518,7 +520,7 @@ varpool_remove_unreferenced_decls (void) ...@@ -518,7 +520,7 @@ varpool_remove_unreferenced_decls (void)
next = next->same_comdat_group) next = next->same_comdat_group)
{ {
varpool_node *vnext = dyn_cast <varpool_node> (next); varpool_node *vnext = dyn_cast <varpool_node> (next);
if (vnext && vnext->analyzed) if (vnext && vnext->analyzed && !symtab_comdat_local_p (next))
enqueue_node (vnext, &first); enqueue_node (vnext, &first);
} }
} }
...@@ -526,10 +528,13 @@ varpool_remove_unreferenced_decls (void) ...@@ -526,10 +528,13 @@ varpool_remove_unreferenced_decls (void)
{ {
varpool_node *vnode = dyn_cast <varpool_node> (ref->referred); varpool_node *vnode = dyn_cast <varpool_node> (ref->referred);
if (vnode if (vnode
&& !vnode->in_other_partition
&& (!DECL_EXTERNAL (ref->referred->decl) && (!DECL_EXTERNAL (ref->referred->decl)
|| vnode->alias) || vnode->alias)
&& vnode->analyzed) && vnode->analyzed)
enqueue_node (vnode, &first); enqueue_node (vnode, &first);
else
pointer_set_insert (referenced, node);
} }
} }
if (cgraph_dump_file) if (cgraph_dump_file)
...@@ -541,9 +546,13 @@ varpool_remove_unreferenced_decls (void) ...@@ -541,9 +546,13 @@ varpool_remove_unreferenced_decls (void)
{ {
if (cgraph_dump_file) if (cgraph_dump_file)
fprintf (cgraph_dump_file, " %s", node->asm_name ()); fprintf (cgraph_dump_file, " %s", node->asm_name ());
varpool_remove_node (node); if (pointer_set_contains (referenced, node))
varpool_remove_initializer (node);
else
varpool_remove_node (node);
} }
} }
pointer_set_destroy (referenced);
if (cgraph_dump_file) if (cgraph_dump_file)
fprintf (cgraph_dump_file, "\n"); fprintf (cgraph_dump_file, "\n");
} }
......
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