Patchwork don't dump decl_uid with TDF_NOUID

login
register
mail settings
Submitter Alexandre Oliva
Date June 3, 2011, 2:17 p.m.
Message ID <or7h93m22g.fsf@livre.localdomain>
Download mbox | patch
Permalink /patch/98587/
State New
Headers show

Comments

Alexandre Oliva - June 3, 2011, 2:17 p.m.
A recent change introduced decl_uid in the “;; Function ” header in dump
files.  This breaks -fcompare-debug (and bootstrap-debug-lean), because
decl uids aren't kept in sync between -g and non-g compilations.

This patch rearranges the header so that decl_uid is omitted when
dumping with NOUID, and it prints the header for the -fcompare-debug
final dump with NOUID.

Regstrapped on x86_64-linux-gnu and i686-linux-gnu.  Ok?
Xinliang David Li - June 3, 2011, 4:06 p.m.
Looks good to me, but you need an OK from a maintainer.

Thanks,

David

On Fri, Jun 3, 2011 at 7:17 AM, Alexandre Oliva <aoliva@redhat.com> wrote:
> A recent change introduced decl_uid in the “;; Function ” header in dump
> files.  This breaks -fcompare-debug (and bootstrap-debug-lean), because
> decl uids aren't kept in sync between -g and non-g compilations.
>
> This patch rearranges the header so that decl_uid is omitted when
> dumping with NOUID, and it prints the header for the -fcompare-debug
> final dump with NOUID.
>
> Regstrapped on x86_64-linux-gnu and i686-linux-gnu.  Ok?
>
>
>
>
> --
> Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
> You must be the change you wish to see in the world. -- Gandhi
> Be Free! -- http://FSFLA.org/   FSF Latin America board member
> Free Software Evangelist      Red Hat Brazil Compiler Engineer
>
>
Richard Guenther - June 6, 2011, 9:38 a.m.
On Fri, Jun 3, 2011 at 4:17 PM, Alexandre Oliva <aoliva@redhat.com> wrote:
> A recent change introduced decl_uid in the “;; Function ” header in dump
> files.  This breaks -fcompare-debug (and bootstrap-debug-lean), because
> decl uids aren't kept in sync between -g and non-g compilations.
>
> This patch rearranges the header so that decl_uid is omitted when
> dumping with NOUID, and it prints the header for the -fcompare-debug
> final dump with NOUID.
>
> Regstrapped on x86_64-linux-gnu and i686-linux-gnu.  Ok?

Ok.

Thanks,
Richard.

>
>
>
> --
> Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
> You must be the change you wish to see in the world. -- Gandhi
> Be Free! -- http://FSFLA.org/   FSF Latin America board member
> Free Software Evangelist      Red Hat Brazil Compiler Engineer
>
>

Patch

for  gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* tree-pretty-print.c (dump_function_header): Add flags.
	Don't dump decl_uid with nouid.
	* tree-pretty-print.h (dump_function_header): Adjust.
	* final.c (rest_of_clean_state): Pass dump_flags on, with nouid.
	* passes.c (pass_init_dump_file): Pass dump_flags on.
	* tree-cfg.c (gimple_dump_cfg): Pass flags on.

Index: gcc/tree-pretty-print.c
===================================================================
--- gcc/tree-pretty-print.c.orig	2011-06-03 00:11:42.155149610 -0300
+++ gcc/tree-pretty-print.c	2011-06-03 00:23:42.369499744 -0300
@@ -3018,7 +3018,7 @@  pp_base_tree_identifier (pretty_printer 
    function dump.  */
 
 void
-dump_function_header (FILE *dump_file, tree fdecl)
+dump_function_header (FILE *dump_file, tree fdecl, int flags)
 {
   const char *dname, *aname;
   struct cgraph_node *node = cgraph_get_node (fdecl);
@@ -3032,11 +3032,13 @@  dump_function_header (FILE *dump_file, t
   else
     aname = "<unset-asm-name>";
 
+  fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d",
+	   dname, aname, fun->funcdef_no);
+  if (!(flags & TDF_NOUID))
+    fprintf (dump_file, ", decl_uid=%d", DECL_UID (fdecl));
   if (node)
     {
-      fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d, decl_uid=%d, cgraph_uid=%d)",
-               dname, aname, fun->funcdef_no, DECL_UID(fdecl), node->uid);
-      fprintf (dump_file, "%s\n\n",
+      fprintf (dump_file, ", cgraph_uid=%d)%s\n\n", node->uid,
                node->frequency == NODE_FREQUENCY_HOT
                ? " (hot)"
                : node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
@@ -3046,6 +3048,5 @@  dump_function_header (FILE *dump_file, t
                : "");
     }
   else
-    fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d, decl_uid = %d)",
-             dname, aname, fun->funcdef_no, DECL_UID(fdecl));
+    fprintf (dump_file, ")\n\n");
 }
Index: gcc/tree-pretty-print.h
===================================================================
--- gcc/tree-pretty-print.h.orig	2011-06-03 00:23:22.350625260 -0300
+++ gcc/tree-pretty-print.h	2011-06-03 00:26:25.826492765 -0300
@@ -50,7 +50,7 @@  extern void debug_generic_expr (tree);
 extern void debug_generic_stmt (tree);
 extern void debug_tree_chain (tree);
 extern void percent_K_format (text_info *);
-extern void dump_function_header (FILE *, tree);
+extern void dump_function_header (FILE *, tree, int);
 
 /* In toplev.c  */
 extern bool default_tree_printer (pretty_printer *, text_info *, const char *,
Index: gcc/final.c
===================================================================
--- gcc/final.c.orig	2011-06-03 00:23:22.615623595 -0300
+++ gcc/final.c	2011-06-03 00:23:33.156557448 -0300
@@ -4361,10 +4361,11 @@  rest_of_clean_state (void)
 	}
       else
 	{
-	  dump_function_header (final_output, current_function_decl);
 	  flag_dump_noaddr = flag_dump_unnumbered = 1;
 	  if (flag_compare_debug_opt || flag_compare_debug)
 	    dump_flags |= TDF_NOUID;
+	  dump_function_header (final_output, current_function_decl,
+				dump_flags);
 	  final_insns_dump_p = true;
 
 	  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
Index: gcc/passes.c
===================================================================
--- gcc/passes.c.orig	2011-06-03 00:23:22.875621962 -0300
+++ gcc/passes.c	2011-06-03 00:52:59.536068338 -0300
@@ -1638,7 +1638,7 @@  pass_init_dump_file (struct opt_pass *pa
       dump_file_name = get_dump_file_name (pass->static_pass_number);
       dump_file = dump_begin (pass->static_pass_number, &dump_flags);
       if (dump_file && current_function_decl)
-        dump_function_header (dump_file, current_function_decl);
+        dump_function_header (dump_file, current_function_decl, dump_flags);
       return initializing_dump;
     }
   else
Index: gcc/tree-cfg.c
===================================================================
--- gcc/tree-cfg.c.orig	2011-06-03 00:23:23.161620166 -0300
+++ gcc/tree-cfg.c	2011-06-03 00:57:20.777549758 -0300
@@ -2052,7 +2052,7 @@  gimple_dump_cfg (FILE *file, int flags)
 {
   if (flags & TDF_DETAILS)
     {
-      dump_function_header (file, current_function_decl);
+      dump_function_header (file, current_function_decl, flags);
       fprintf (file, ";; \n%d basic blocks, %d edges, last basic block %d.\n\n",
 	       n_basic_blocks, n_edges, last_basic_block);