This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][4.1] Fix PR27882, GC bug during inlining


This is one possible fix for the GC collecting a node which we
will continue to visit.  I verified we do not regress in terms
of memory usage for tramp3d, DLV or mico.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

Ok for the 4.1 branch?  (The problem looks latent on the mainline)

Thanks,
Richard.

2006-07-20  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/27882
	* ipa-inline.c (cgraph_early_inlining): Collect at
	callgraph root and tail nodes only.

Index: ipa-inline.c
===================================================================
*** ipa-inline.c	(revision 115554)
--- ipa-inline.c	(working copy)
*************** cgraph_early_inlining (void)
*** 1133,1138 ****
--- 1133,1139 ----
    struct cgraph_node **order =
      xcalloc (cgraph_n_nodes, sizeof (struct cgraph_node *));
    int i;
+   bool inlined = false;
  
    if (sorrycount || errorcount)
      return;
*************** cgraph_early_inlining (void)
*** 1148,1156 ****
        if (node->analyzed && node->local.inlinable
  	  && (node->needed || node->reachable)
  	  && node->callers)
  	{
! 	  if (cgraph_decide_inlining_incrementally (node, true))
! 	    ggc_collect ();
  	}
      }
    cgraph_remove_unreachable_nodes (true, dump_file);
--- 1149,1161 ----
        if (node->analyzed && node->local.inlinable
  	  && (node->needed || node->reachable)
  	  && node->callers)
+ 	inlined |= cgraph_decide_inlining_incrementally (node, true);
+       /* Collect at cgraph roots, which avoids collecting inside cycles.  */
+       if (inlined
+ 	  && (!node->callers || !node->callees))
  	{
! 	  ggc_collect ();
! 	  inlined = false;
  	}
      }
    cgraph_remove_unreachable_nodes (true, dump_file);
*************** cgraph_early_inlining (void)
*** 1159,1164 ****
--- 1164,1170 ----
      gcc_assert (!node->global.inlined_to);
  #endif
    free (order);
+   ggc_collect ();
  }
  
  /* When inlining shall be performed.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]