Patchwork Fix PR46188

login
register
mail settings
Submitter Richard Guenther
Date April 19, 2011, 8:58 a.m.
Message ID <alpine.LNX.2.00.1104191055340.810@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/91940/
State New
Headers show

Comments

Richard Guenther - April 19, 2011, 8:58 a.m.
This fixes PR46188 on the 4.5 branch by backporting rev. 159907.  Instead
of carrying over the checking bits I simply removed them on the branch
(they had one trivial fallout originally, PR44295).

Bootstrapped and tested on x86_64-unknown-linux-gnu, {,-m32} for
all languages including Ada and Objective-C++ with checking enabled.

I wasn't able to distill a testcase without output to stdout.

Installed on the branch.

Richard.

2011-04-19  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/46188
	Backported from 4.6 branch
	2010-05-26  Jan Hubicka  <jh@suse.cz>

	* cgraphunit.c (clone_of_p): Remove.
	(verify_cgraph_node): Do not verify clones.
	(cgraph_materialize_all_clones): Do no redirection here.
	* ipa-inline.c (inline_transform): Do redirection here.

Patch

Index: gcc/cgraphunit.c
===================================================================
--- gcc/cgraphunit.c	(revision 172653)
+++ gcc/cgraphunit.c	(working copy)
@@ -553,15 +553,6 @@  cgraph_mark_if_needed (tree decl)
     cgraph_mark_needed_node (node);
 }
 
-/* Return TRUE if NODE2 is equivalent to NODE or its clone.  */
-static bool
-clone_of_p (struct cgraph_node *node, struct cgraph_node *node2)
-{
-  while (node != node2 && node2)
-    node2 = node2->clone_of;
-  return node2 != NULL;
-}
-
 /* Verify cgraph nodes of given cgraph node.  */
 void
 verify_cgraph_node (struct cgraph_node *node)
@@ -777,16 +768,6 @@  verify_cgraph_node (struct cgraph_node *
 			    debug_tree (e->callee->decl);
 			    error_found = true;
 			  }
-			else if (!node->global.inlined_to
-				 && !e->callee->global.inlined_to
-				 && !clone_of_p (cgraph_node (decl), e->callee))
-			  {
-			    error ("edge points to wrong declaration:");
-			    debug_tree (e->callee->decl);
-			    fprintf (stderr," Instead of:");
-			    debug_tree (decl);
-			    error_found = true;
-			  }
 			e->aux = (void *)1;
 		      }
 		    else
@@ -2397,30 +2378,7 @@  cgraph_materialize_all_clones (void)
     if (!node->analyzed && node->callees)
       cgraph_node_remove_callees (node);
   if (cgraph_dump_file)
-    fprintf (cgraph_dump_file, "Updating call sites\n");
-  for (node = cgraph_nodes; node; node = node->next)
-    if (node->analyzed && !node->clone_of
-	&& gimple_has_body_p (node->decl))
-      {
-        struct cgraph_edge *e;
-
-	current_function_decl = node->decl;
-        push_cfun (DECL_STRUCT_FUNCTION (node->decl));
-	for (e = node->callees; e; e = e->next_callee)
-	  cgraph_redirect_edge_call_stmt_to_callee (e);
-	pop_cfun ();
-	current_function_decl = NULL;
-#ifdef ENABLE_CHECKING
-        verify_cgraph_node (node);
-#endif
-      }
-  if (cgraph_dump_file)
     fprintf (cgraph_dump_file, "Materialization Call site updates done.\n");
-  /* All changes to parameters have been performed.  In order not to
-     incorrectly repeat them, we simply dispose of the bitmaps that drive the
-     changes. */
-  for (node = cgraph_nodes; node; node = node->next)
-    node->clone.combined_args_to_skip = NULL;
 #ifdef ENABLE_CHECKING
   verify_cgraph ();
 #endif
Index: gcc/ipa-inline.c
===================================================================
--- gcc/ipa-inline.c	(revision 172653)
+++ gcc/ipa-inline.c	(working copy)
@@ -2092,6 +2092,7 @@  inline_transform (struct cgraph_node *no
 {
   unsigned int todo = 0;
   struct cgraph_edge *e;
+  bool inline_p = false;
 
   /* FIXME: Currently the passmanager is adding inline transform more than once to some
      clones.  This needs revisiting after WPA cleanups.  */
@@ -2104,10 +2105,13 @@  inline_transform (struct cgraph_node *no
     save_inline_function_body (node);
 
   for (e = node->callees; e; e = e->next_callee)
-    if (!e->inline_failed || warn_inline)
-      break;
+    {
+      cgraph_redirect_edge_call_stmt_to_callee (e);
+      if (!e->inline_failed || warn_inline)
+	inline_p = true;
+    }
 
-  if (e)
+  if (inline_p)
     {
       timevar_push (TV_INTEGRATION);
       todo = optimize_inline_calls (current_function_decl);