public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: gcc-patches@gcc.gnu.org
Subject: Cgraph alias reorg 9/14 (skip aliases in ipa-cp)
Date: Fri, 10 Jun 2011 15:55:00 -0000	[thread overview]
Message-ID: <20110610154948.GG28776@kam.mff.cuni.cz> (raw)

Hi.
this patch updates ipa-cp to skip aliases.  Since it includes some reformating, I decided
to leave it for separate patch.
It also prevents ipa-cp from an attempt to clone or propagate through thunks.  We still
don't do any jump functions on those.

Regtested/boostrapped x86_64-linux, will commit it shortly.

Honza

	* ipa-cp.c (ipcp_versionable_function_p): Thunks are not versionable.
	(ipcp_initialize_node_lattices): Do not deal with aliases; Do not try to
	propagate through thunks.
	(ipcp_change_tops_to_bottom): Do not deal with aliases.
Index: ipa-cp.c
===================================================================
--- ipa-cp.c	(revision 174911)
+++ ipa-cp.c	(working copy)
@@ -354,6 +354,10 @@ ipcp_versionable_function_p (struct cgra
   if (node->alias)
     return false;
 
+  /* We don't know how to clone thunks.  */
+  if (node->thunk.thunk_p)
+    return false;
+
   /* There are a number of generic reasons functions cannot be versioned.  We
      also cannot remove parameters if there are type attributes such as fnspec
      present.  */
@@ -507,9 +511,11 @@ ipcp_initialize_node_lattices (struct cg
   struct ipa_node_params *info = IPA_NODE_REF (node);
   enum ipa_lattice_type type;
 
-  if (ipa_is_called_with_var_arguments (info) || node->alias)
+  if (ipa_is_called_with_var_arguments (info))
     type = IPA_BOTTOM;
-  else if (node->local.local)
+  /* We don't know how to clone thunks even when they are local.  */
+  else if (node->local.local
+	   && !node->thunk.thunk_p)
     type = IPA_TOP;
   /* When cloning is allowed, we can assume that externally visible functions
      are not called.  We will compensate this by cloning later.  */
@@ -592,40 +598,41 @@ ipcp_change_tops_to_bottom (void)
 
   prop_again = false;
   for (node = cgraph_nodes; node; node = node->next)
-    {
-      struct ipa_node_params *info = IPA_NODE_REF (node);
-      count = ipa_get_param_count (info);
-      for (i = 0; i < count; i++)
-	{
-	  struct ipcp_lattice *lat = ipa_get_lattice (info, i);
-	  if (lat->type == IPA_TOP)
-	    {
-	      prop_again = true;
-	      if (dump_file)
-		{
-		  fprintf (dump_file, "Forcing param ");
-		  print_generic_expr (dump_file, ipa_get_param (info, i), 0);
-		  fprintf (dump_file, " of node %s to bottom.\n",
-			   cgraph_node_name (node));
-		}
-	      lat->type = IPA_BOTTOM;
-	    }
-	  if (!ipa_param_cannot_devirtualize_p (info, i)
-	      && ipa_param_types_vec_empty (info, i))
-	    {
-	      prop_again = true;
-	      ipa_set_param_cannot_devirtualize (info, i);
-	      if (dump_file)
-		{
-		  fprintf (dump_file, "Marking param ");
-		  print_generic_expr (dump_file, ipa_get_param (info, i), 0);
-		  fprintf (dump_file, " of node %s as unusable for "
-			   "devirtualization.\n",
-			   cgraph_node_name (node));
-		}
-	    }
-	}
-    }
+    if (!node->alias)
+      {
+	struct ipa_node_params *info = IPA_NODE_REF (node);
+	count = ipa_get_param_count (info);
+	for (i = 0; i < count; i++)
+	  {
+	    struct ipcp_lattice *lat = ipa_get_lattice (info, i);
+	    if (lat->type == IPA_TOP)
+	      {
+		prop_again = true;
+		if (dump_file)
+		  {
+		    fprintf (dump_file, "Forcing param ");
+		    print_generic_expr (dump_file, ipa_get_param (info, i), 0);
+		    fprintf (dump_file, " of node %s to bottom.\n",
+			     cgraph_node_name (node));
+		  }
+		lat->type = IPA_BOTTOM;
+	      }
+	    if (!ipa_param_cannot_devirtualize_p (info, i)
+		&& ipa_param_types_vec_empty (info, i))
+	      {
+		prop_again = true;
+		ipa_set_param_cannot_devirtualize (info, i);
+		if (dump_file)
+		  {
+		    fprintf (dump_file, "Marking param ");
+		    print_generic_expr (dump_file, ipa_get_param (info, i), 0);
+		    fprintf (dump_file, " of node %s as unusable for "
+			     "devirtualization.\n",
+			     cgraph_node_name (node));
+		  }
+	      }
+	  }
+      }
   return prop_again;
 }
 
@@ -813,10 +820,11 @@ ipcp_iterate_stage (void)
     ipa_update_after_lto_read ();
 
   for (node = cgraph_nodes; node; node = node->next)
-    {
-      ipcp_initialize_node_lattices (node);
-      ipcp_compute_node_scale (node);
-    }
+    if (!node->alias)
+      {
+	ipcp_initialize_node_lattices (node);
+	ipcp_compute_node_scale (node);
+      }
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
       ipcp_print_all_lattices (dump_file);

                 reply	other threads:[~2011-06-10 15:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110610154948.GG28776@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).