Patchwork Dump cgraph before merging

login
register
mail settings
Submitter Jan Hubicka
Date July 4, 2010, 1:26 p.m.
Message ID <20100704132635.GB22746@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/57842/
State New
Headers show

Comments

Jan Hubicka - July 4, 2010, 1:26 p.m.
Hi,
while working on Mozilla LTO problems I found useful to have dump of callgraph
before merging is done.
Bootstrapped/regtested x86_64-linux, will commit it later today.

Honza

	* cgraphunit.c (init_cgraph): Only initialize dump file if it is not already
	initialized. 
	* lto/lto.c (read_cgraph_and_symbols): Dump cgraph before merging.
Basile Starynkevitch - July 4, 2010, 3:25 p.m.
On Sun, 2010-07-04 at 15:26 +0200, Jan Hubicka wrote:
> Hi,
> while working on Mozilla LTO problems I found useful to have dump of callgraph
> before merging is done.
> +  if (cgraph_dump_file)
> +    {
> +      if (cgraph_dump_file)
> +	fprintf (cgraph_dump_file, "Before merging:\n");

Why do you test twice cgraph_dump_file?

Cheers.
Jan Hubicka - July 4, 2010, 3:40 p.m.
> On Sun, 2010-07-04 at 15:26 +0200, Jan Hubicka wrote:
> > Hi,
> > while working on Mozilla LTO problems I found useful to have dump of callgraph
> > before merging is done.
> > +  if (cgraph_dump_file)
> > +    {
> > +      if (cgraph_dump_file)
> > +	fprintf (cgraph_dump_file, "Before merging:\n");
> 
> Why do you test twice cgraph_dump_file?
A pasto.  I will fix that before comitting.

Honza

Patch

Index: cgraphunit.c
===================================================================
--- cgraphunit.c	(revision 161774)
+++ cgraphunit.c	(working copy)
@@ -2070,7 +2070,8 @@  cgraph_build_static_cdtor (char which, t
 void
 init_cgraph (void)
 {
-  cgraph_dump_file = dump_begin (TDI_cgraph, NULL);
+  if (!cgraph_dump_file)
+    cgraph_dump_file = dump_begin (TDI_cgraph, NULL);
 }
 
 /* The edges representing the callers of the NEW_VERSION node were
Index: lto/lto.c
===================================================================
--- lto/lto.c	(revision 161774)
+++ lto/lto.c	(working copy)
@@ -1435,6 +1449,7 @@  read_cgraph_and_symbols (unsigned nfiles
   struct cgraph_node *node;
 
   lto_stats.num_input_files = nfiles;
+  init_cgraph ();
 
   timevar_push (TV_IPA_LTO_DECL_IO);
 
@@ -1534,6 +1549,13 @@  read_cgraph_and_symbols (unsigned nfiles
 
   /* Finally merge the cgraph according to the decl merging decisions.  */
   timevar_push (TV_IPA_LTO_CGRAPH_MERGE);
+  if (cgraph_dump_file)
+    {
+      if (cgraph_dump_file)
+	fprintf (cgraph_dump_file, "Before merging:\n");
+      dump_cgraph (cgraph_dump_file);
+      dump_varpool (cgraph_dump_file);
+    }
   lto_symtab_merge_cgraph_nodes ();
   ggc_collect ();