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]

Re: [PATCH] Fix UID difference code-differences in bootstrap


On Sat, 28 Nov 2009, Richard Guenther wrote:

> 
> This fixes the only case that causes code differences during
> bootstrap when the UID increment is randomized.  Alex, is
> there a bootstrap kind that compares more (but does not choke
> on UID differences)?

With that, the TDF_NOUID patch and the following I can still
pass bootstrap-debug (but not without the above patch).  Also
-fcompare-debug still works on the files I tried (I'll dig
out the build-config details to throw it on a full bootstrap).

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

Richard.

2009-11-29  Richard Guenther  <rguenther@suse.de>

	* tree-into-ssa.c (insert_phi_nodes): Add PHI nodes in
	variable UID order.

	* final.c (rest_of_clean_state): If -fcompare-debug is
	given dump final insns without UIDs.
	* tree-ssa-live.c (remove_unused_scope_block_p): Remove
	after_inlining checks.

Index: gcc/tree-into-ssa.c
===================================================================
*** gcc/tree-into-ssa.c.orig	2009-11-29 16:14:21.000000000 +0100
--- gcc/tree-into-ssa.c	2009-11-29 16:19:50.000000000 +0100
*************** static void
*** 1151,1177 ****
  insert_phi_nodes (bitmap *dfs)
  {
    referenced_var_iterator rvi;
    tree var;
  
    timevar_push (TV_TREE_INSERT_PHI_NODES);
  
    FOR_EACH_REFERENCED_VAR (var, rvi)
      {
        struct def_blocks_d *def_map;
-       bitmap idf;
  
        def_map = find_def_blocks_for (var);
        if (def_map == NULL)
  	continue;
  
        if (get_phi_state (var) != NEED_PHI_STATE_NO)
! 	{
! 	  idf = compute_idf (def_map->def_blocks, dfs);
! 	  insert_phi_nodes_for (var, idf, false);
! 	  BITMAP_FREE (idf);
! 	}
      }
  
    timevar_pop (TV_TREE_INSERT_PHI_NODES);
  }
  
--- 1151,1193 ----
  insert_phi_nodes (bitmap *dfs)
  {
    referenced_var_iterator rvi;
+   bitmap_iterator bi;
    tree var;
+   bitmap vars;
+   unsigned uid;
  
    timevar_push (TV_TREE_INSERT_PHI_NODES);
  
+   /* Do two stages to avoid code generation differences for UID
+      differences but no UID ordering differences.  */
+ 
+   vars = BITMAP_ALLOC (NULL);
    FOR_EACH_REFERENCED_VAR (var, rvi)
      {
        struct def_blocks_d *def_map;
  
        def_map = find_def_blocks_for (var);
        if (def_map == NULL)
  	continue;
  
        if (get_phi_state (var) != NEED_PHI_STATE_NO)
! 	bitmap_set_bit (vars, DECL_UID (var));
      }
  
+   EXECUTE_IF_SET_IN_BITMAP (vars, 0, uid, bi)
+     {
+       tree var = referenced_var (uid);
+       struct def_blocks_d *def_map;
+       bitmap idf;
+ 
+       def_map = find_def_blocks_for (var);
+       idf = compute_idf (def_map->def_blocks, dfs);
+       insert_phi_nodes_for (var, idf, false);
+       BITMAP_FREE (idf);
+     }
+ 
+   BITMAP_FREE (vars);
+ 
    timevar_pop (TV_TREE_INSERT_PHI_NODES);
  }
  
Index: gcc/final.c
===================================================================
*** gcc/final.c.orig	2009-11-29 16:14:21.000000000 +0100
--- gcc/final.c	2009-11-29 16:19:50.000000000 +0100
*************** rest_of_clean_state (void)
*** 4382,4387 ****
--- 4382,4389 ----
  	     : "");
  
  	  flag_dump_noaddr = flag_dump_unnumbered = 1;
+ 	  if (flag_compare_debug_opt || flag_compare_debug)
+ 	    dump_flags |= TDF_NOUID;
  
  	  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
  	    if (LABEL_P (insn))
Index: gcc/tree-ssa-live.c
===================================================================
*** gcc/tree-ssa-live.c.orig	2009-11-29 16:14:21.000000000 +0100
--- gcc/tree-ssa-live.c	2009-11-29 16:19:50.000000000 +0100
*************** remove_unused_scope_block_p (tree scope)
*** 475,485 ****
  	 type is used or not.  */
  
        else if (debug_info_level == DINFO_LEVEL_NORMAL
! 	       || debug_info_level == DINFO_LEVEL_VERBOSE
! 	       /* Removing declarations before inlining is going to affect
! 		  DECL_UID that in turn is going to affect hashtables and
! 		  code generation.  */
! 	       || !cfun->after_inlining)
  	;
        else
  	{
--- 475,481 ----
  	 type is used or not.  */
  
        else if (debug_info_level == DINFO_LEVEL_NORMAL
! 	       || debug_info_level == DINFO_LEVEL_VERBOSE)
  	;
        else
  	{
*************** remove_unused_scope_block_p (tree scope)
*** 527,538 ****
        eliminated.  */
     else if (!nsubblocks)
       ;
-    /* If there are live subblocks and we still have some unused variables
-       or types declared, we must keep them.
-       Before inliing we must not depend on debug info verbosity to keep
-       DECL_UIDs stable.  */
-    else if (!cfun->after_inlining && BLOCK_VARS (scope))
-      unused = false;
     /* For terse debug info we can eliminate info on unused variables.  */
     else if (debug_info_level == DINFO_LEVEL_NONE
  	    || debug_info_level == DINFO_LEVEL_TERSE)
--- 523,528 ----


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