re PR tree-optimization/17509 (ICE in verify_cgraph_node)
authorJan Hubicka <jh@suse.cz>
Fri, 17 Sep 2004 21:04:56 +0000 (23:04 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Fri, 17 Sep 2004 21:04:56 +0000 (21:04 +0000)
PR tree-optimization/17509
* tree-optimize.c (update_inlined_to_pointers): New function.
(tree_rest_of_compilation): Use it.

From-SVN: r87669

gcc/ChangeLog
gcc/tree-optimize.c

index 9b11e42c71c8376cf6d1c63fc3ef1dab4543d744..ff1725f5a97c316b2a43f058716731ea885c83d2 100644 (file)
@@ -1,3 +1,9 @@
+2004-09-17  Jan Hubicka  <jh@suse.cz>
+
+       PR tree-optimization/17509
+       * tree-optimize.c (update_inlined_to_pointers): New function.
+       (tree_rest_of_compilation): Use it.
+
 2004-09-17  Devang Patel  <dpatel@apple.com>
 
        * dbxout.c (get_lang_number): New.
index b9a2fa55ecea985bed0634977ac3e42b4174e888..fdb7e766a25b897223f38d5b22a1ee904adbd7fb 100644 (file)
@@ -539,6 +539,24 @@ execute_pass_list (struct tree_opt_pass *pass)
     }
   while (pass);
 }
+\f
+
+/* update recursivly all inlined_to pointers of functions
+   inlined into NODE to INLINED_TO.  */
+static void
+update_inlined_to_pointers (struct cgraph_node *node,
+                           struct cgraph_node *inlined_to)
+{
+  struct cgraph_edge *e;
+  for (e = node->callees; e; e = e->next_callee)
+    {
+      if (e->callee->global.inlined_to)
+       {
+         e->callee->global.inlined_to = inlined_to;
+         update_inlined_to_pointers (e->callee, node);
+       }
+    }
+}
 
 \f
 /* For functions-as-trees languages, this performs all optimization and
@@ -630,6 +648,7 @@ tree_rest_of_compilation (tree fndecl, bool nested_p)
       if (!flag_unit_at_a_time)
        {
          struct cgraph_edge *e;
+         verify_cgraph ();
          while (node->callees)
            cgraph_remove_edge (node->callees);
          node->callees = saved_node->callees;
@@ -637,7 +656,10 @@ tree_rest_of_compilation (tree fndecl, bool nested_p)
          for (e = node->callees; e; e = e->next_callee)
            {
              if (e->callee->global.inlined_to)
-               e->callee->global.inlined_to = node;
+               {
+                 e->callee->global.inlined_to = node;
+                 update_inlined_to_pointers (e->callee, node);
+               }
              e->caller = node;
            }
          cgraph_remove_node (saved_node);