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]

[tree-ssa] More minor speedups for into-ssa and dominator optimizer



First, rather than VARRAY_CLEAR the block local stacks in the block local
data initializers, we instead should be verifying that the block local
stacks are empty.  Saves a trivial amount of time.  The whole thing belongs
inside an ENABLE_CHECKING block.  Done.

Second, we were marking the arguments to bypassed PHIs as needing to be
taken out of SSA form.  I can't remember why I did that, and well, it
simply seems wrong.  The per-variable out of SSA code handles the case
where the destination of the PHI is marked for out-of-ssa translation, but
one or more arguments is not.

By not marking those arguments as needing to be taken out of SSA form, we
avoid a small amount of work in the case where the destination of a PHI
is marked for renaming, but an argument is not.

Bootstrapped and regression tested on i686-pc-linux-gnu.

	* tree-into-ssa.c (rewrite_initialize_block_local_data): Mark all
	arguments as potentially unused.  Do not bother to VARRAY_CLEAR
	the block_defs.  Instead abort if we are presented with a block
	which has a nonempty block_defs.  Wrap entire thing inside 
	#ifdef ENABLE_CHECKING.
	* tree-ssa-dom.c (dom_opt_initialize_block_local_data): Similarly

	* tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Do not mark
	arguments to bypassed PHIs as needing to be rewritten.

Index: tree-into-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-into-ssa.c,v
retrieving revision 1.1.2.7
diff -c -p -r1.1.2.7 tree-into-ssa.c
*** tree-into-ssa.c	21 Apr 2004 18:02:20 -0000	1.1.2.7
--- tree-into-ssa.c	22 Apr 2004 16:30:43 -0000
*************** insert_phi_nodes (bitmap *dfs)
*** 456,465 ****
     pushed into this stack so that we can restore it in Step 5.  */
  
  static void
! rewrite_initialize_block_local_data (struct dom_walk_data *walk_data,
  				     basic_block bb ATTRIBUTE_UNUSED,
! 				     bool recycled)
  {
    struct rewrite_block_data *bd
      = (struct rewrite_block_data *)VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
                                                                                  
--- 456,466 ----
     pushed into this stack so that we can restore it in Step 5.  */
  
  static void
! rewrite_initialize_block_local_data (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
  				     basic_block bb ATTRIBUTE_UNUSED,
! 				     bool recycled ATTRIBUTE_UNUSED)
  {
+ #ifdef ENABLE_CHECKING
    struct rewrite_block_data *bd
      = (struct rewrite_block_data *)VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
                                                                                  
*************** rewrite_initialize_block_local_data (str
*** 467,474 ****
       not cleared, then we are re-using a previously allocated entry.  In
       that case, we can also re-use the underlying virtal arrays.  Just
       make sure we clear them before using them!  */
!   if (recycled && bd->block_defs)
!     VARRAY_CLEAR (bd->block_defs);
  }
  
  
--- 468,476 ----
       not cleared, then we are re-using a previously allocated entry.  In
       that case, we can also re-use the underlying virtal arrays.  Just
       make sure we clear them before using them!  */
!   if (recycled && bd->block_defs && VARRAY_ACTIVE_SIZE (bd->block_defs) > 0)
!     abort ();
! #endif
  }
  
  
Index: tree-ssa-dom.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-dom.c,v
retrieving revision 1.1.2.159
diff -c -p -r1.1.2.159 tree-ssa-dom.c
*** tree-ssa-dom.c	21 Apr 2004 18:02:20 -0000	1.1.2.159
--- tree-ssa-dom.c	22 Apr 2004 16:30:48 -0000
*************** redirect_edges_and_update_ssa_graph (var
*** 333,352 ****
        for (phi = phi_nodes (e->dest); phi; phi = TREE_CHAIN (phi))
  	{
  	  tree result = SSA_NAME_VAR (PHI_RESULT (phi));
- 	  int j;
- 
  	  bitmap_set_bit (vars_to_rename, var_ann (result)->uid);
- 
- 	  for (j = 0; j < PHI_NUM_ARGS (phi); j++)
- 	    {
- 	      tree arg = PHI_ARG_DEF (phi, j);
- 
- 	      if (TREE_CODE (arg) != SSA_NAME)
- 		continue;
- 
- 	      arg = SSA_NAME_VAR (arg);
- 	      bitmap_set_bit (vars_to_rename, var_ann (arg)->uid);
- 	    }
          }
  
        /* Any variables set by statements at the start of the block we
--- 333,339 ----
*************** redirect_edges_and_update_ssa_graph (var
*** 510,516 ****
        bitmap_set_bit (vars_to_rename, i);
        var_ann (referenced_var (i))->out_of_ssa_tag = 0;
      }
- 
  }
  
  /* Jump threading, redundancy elimination and const/copy propagation. 
--- 497,502 ----
*************** thread_across_edge (struct dom_walk_data
*** 942,951 ****
       
     AVAIL_EXPRS stores all the expressions made available in this block.
  
-    TRUE_EXPRS stores all expressions with a true value made in this block.
- 
-    FALSE_EXPRS stores all expressions with a false value made in this block.
- 
     CONST_AND_COPIES stores var/value pairs to restore at the end of this
     block.
  
--- 928,933 ----
*************** thread_across_edge (struct dom_walk_data
*** 961,970 ****
     block.  */
  
  static void
! dom_opt_initialize_block_local_data (struct dom_walk_data *walk_data,
  				     basic_block bb ATTRIBUTE_UNUSED,
! 				     bool recycled)
  {
    struct dom_walk_block_data *bd
      = (struct dom_walk_block_data *)VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
  
--- 943,953 ----
     block.  */
  
  static void
! dom_opt_initialize_block_local_data (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
  				     basic_block bb ATTRIBUTE_UNUSED,
! 				     bool recycled ATTRIBUTE_UNUSED)
  {
+ #ifdef ENABLE_CHECKING
    struct dom_walk_block_data *bd
      = (struct dom_walk_block_data *)VARRAY_TOP_GENERIC_PTR (walk_data->block_data_stack);
  
*************** dom_opt_initialize_block_local_data (str
*** 974,992 ****
       make sure we clear them before using them!  */
    if (recycled)
      {
!       if (bd->avail_exprs)
! 	VARRAY_CLEAR (bd->avail_exprs);
!       if (bd->const_and_copies)
! 	VARRAY_CLEAR (bd->const_and_copies);
!       if (bd->nonzero_vars)
! 	VARRAY_CLEAR (bd->nonzero_vars);
!       if (bd->stmts_to_rescan)
! 	VARRAY_CLEAR (bd->stmts_to_rescan);
!       if (bd->vrp_variables)
! 	VARRAY_CLEAR (bd->vrp_variables);
!       if (bd->block_defs)
! 	VARRAY_CLEAR (bd->block_defs);
      }
  }
  
  /* Initialize local stacks for this optimizer and record equivalences
--- 957,976 ----
       make sure we clear them before using them!  */
    if (recycled)
      {
!       if (bd->avail_exprs && VARRAY_ACTIVE_SIZE (bd->avail_exprs) > 0)
! 	abort ();
!       if (bd->const_and_copies && VARRAY_ACTIVE_SIZE (bd->const_and_copies) > 0)
! 	abort ();
!       if (bd->nonzero_vars && VARRAY_ACTIVE_SIZE (bd->nonzero_vars) > 0)
! 	abort ();
!       if (bd->stmts_to_rescan && VARRAY_ACTIVE_SIZE (bd->stmts_to_rescan) > 0)
! 	abort ();
!       if (bd->vrp_variables && VARRAY_ACTIVE_SIZE (bd->vrp_variables) > 0)
! 	abort ();
!       if (bd->block_defs && VARRAY_ACTIVE_SIZE (bd->block_defs) > 0)
! 	abort ();
      }
+ #endif
  }
  
  /* Initialize local stacks for this optimizer and record equivalences



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