Patchwork Drop more of the old alias handling code

login
register
mail settings
Submitter Jan Hubicka
Date April 9, 2013, 10:46 p.m.
Message ID <20130409224643.GC24359@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/235256/
State New
Headers show

Comments

Jan Hubicka - April 9, 2013, 10:46 p.m.
Hi,
this patch removes handling of alias pairs in ipa.c.  This code is no longer needed
now when we represent all aliases explicitly in the symbol table.

Bootstrapped/regtested x86_64-linux.

Honza

	* ipa.c (cgraph_externally_visible_p, varpool_externally_visible_p): Drop
	aliased parameter.
	(function_and_variable_visibility): Do not handle alias pairs.
	* cgraph.c (varpool_externally_visible_p): Update prototype.
	* varpool.c (varpool_add_new_variable): Update.

Patch

Index: ipa.c
===================================================================
--- ipa.c	(revision 197243)
+++ ipa.c	(working copy)
@@ -573,7 +573,7 @@  cgraph_comdat_can_be_unshared_p (struct
 
 static bool
 cgraph_externally_visible_p (struct cgraph_node *node,
-			     bool whole_program, bool aliased)
+			     bool whole_program)
 {
   if (!node->local.finalized)
     return false;
@@ -582,11 +582,6 @@  cgraph_externally_visible_p (struct cgra
 	  || DECL_EXTERNAL (node->symbol.decl)))
     return false;
 
-  /* Do not even try to be smart about aliased nodes.  Until we properly
-     represent everything by same body alias, these are just evil.  */
-  if (aliased)
-    return true;
-
   /* Do not try to localize built-in functions yet.  One of problems is that we
      end up mangling their asm for WHOPR that makes it impossible to call them
      using the implicit built-in declarations anymore.  Similarly this enables
@@ -638,7 +633,7 @@  cgraph_externally_visible_p (struct cgra
 /* Return true when variable VNODE should be considered externally visible.  */
 
 bool
-varpool_externally_visible_p (struct varpool_node *vnode, bool aliased)
+varpool_externally_visible_p (struct varpool_node *vnode)
 {
   /* Do not touch weakrefs; while they are not externally visible,
      dropping their DECL_EXTERNAL flags confuse most
@@ -652,11 +647,6 @@  varpool_externally_visible_p (struct var
   if (!DECL_COMDAT (vnode->symbol.decl) && !TREE_PUBLIC (vnode->symbol.decl))
     return false;
 
-  /* Do not even try to be smart about aliased nodes.  Until we properly
-     represent everything by same body alias, these are just evil.  */
-  if (aliased)
-    return true;
-
   /* If linker counts on us, we must preserve the function.  */
   if (symtab_used_from_object_file_p ((symtab_node) vnode))
     return true;
@@ -733,42 +723,9 @@  function_and_variable_visibility (bool w
 {
   struct cgraph_node *node;
   struct varpool_node *vnode;
-  struct pointer_set_t *aliased_nodes = pointer_set_create ();
-  struct pointer_set_t *aliased_vnodes = pointer_set_create ();
-  unsigned i;
-  alias_pair *p;
 
-  /* Discover aliased nodes.  */
-  FOR_EACH_VEC_SAFE_ELT (alias_pairs, i, p)
-    {
-      if (dump_file)
-      fprintf (dump_file, "Alias %s->%s",
-	       IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (p->decl)),
-	       IDENTIFIER_POINTER (p->target));
-		
-      if ((node = cgraph_node_for_asm (p->target)) != NULL
-	   && !DECL_EXTERNAL (node->symbol.decl))
-	{
-	  if (!node->analyzed)
-	    continue;
-	  cgraph_mark_force_output_node (node);
-	  pointer_set_insert (aliased_nodes, node);
-	  if (dump_file)
-	    fprintf (dump_file, "  node %s/%i",
-		     cgraph_node_name (node), node->uid);
-	}
-      else if ((vnode = varpool_node_for_asm (p->target)) != NULL
-	       && !DECL_EXTERNAL (vnode->symbol.decl))
-	{
-	  vnode->symbol.force_output = 1;
-	  pointer_set_insert (aliased_vnodes, vnode);
-	  if (dump_file)
-	    fprintf (dump_file, "  varpool node %s",
-		     varpool_node_name (vnode));
-	}
-      if (dump_file)
-	fprintf (dump_file, "\n");
-    }
+  /* All aliases should be procssed at this point.  */
+  gcc_checking_assert (!alias_pairs || !alias_pairs->length());
 
   FOR_EACH_FUNCTION (node)
     {
@@ -817,9 +774,7 @@  function_and_variable_visibility (bool w
 		  && !DECL_COMDAT (node->symbol.decl))
       	          || TREE_PUBLIC (node->symbol.decl)
 		  || DECL_EXTERNAL (node->symbol.decl));
-      if (cgraph_externally_visible_p (node, whole_program,
-				       pointer_set_contains (aliased_nodes,
-							     node)))
+      if (cgraph_externally_visible_p (node, whole_program))
         {
 	  gcc_assert (!node->global.inlined_to);
 	  node->symbol.externally_visible = true;
@@ -898,9 +853,7 @@  function_and_variable_visibility (bool w
     {
       if (!vnode->finalized)
         continue;
-      if (varpool_externally_visible_p
-	    (vnode, 
-	     pointer_set_contains (aliased_vnodes, vnode)))
+      if (varpool_externally_visible_p (vnode))
 	vnode->symbol.externally_visible = true;
       else
         vnode->symbol.externally_visible = false;
@@ -913,8 +866,6 @@  function_and_variable_visibility (bool w
 	  vnode->symbol.resolution = LDPR_PREVAILING_DEF_IRONLY;
 	}
     }
-  pointer_set_destroy (aliased_nodes);
-  pointer_set_destroy (aliased_vnodes);
 
   if (dump_file)
     {
Index: cgraph.h
===================================================================
--- cgraph.h	(revision 197242)
+++ cgraph.h	(working copy)
@@ -726,7 +726,7 @@  void debug_varpool_node_set (varpool_nod
 void free_varpool_node_set (varpool_node_set);
 void ipa_discover_readonly_nonaddressable_vars (void);
 bool cgraph_comdat_can_be_unshared_p (struct cgraph_node *);
-bool varpool_externally_visible_p (struct varpool_node *, bool);
+bool varpool_externally_visible_p (struct varpool_node *);
 
 /* In predict.c  */
 bool cgraph_maybe_hot_edge_p (struct cgraph_edge *e);
Index: varpool.c
===================================================================
--- varpool.c	(revision 197242)
+++ varpool.c	(working copy)
@@ -191,7 +191,7 @@  varpool_add_new_variable (tree decl)
   struct varpool_node *node;
   varpool_finalize_decl (decl);
   node = varpool_node_for_decl (decl);
-  if (varpool_externally_visible_p (node, false))
+  if (varpool_externally_visible_p (node))
     node->symbol.externally_visible = true;
 }