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][alias-improvements] Some more VOP renaming tweaks


No need to do manual renaming in forwprop or DCE.  And we can avoid
automatic renaming on VDEF removal by propagating the associated VUSE
properly.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to the
branch.

Richard.

2009-01-12  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-forwprop.c (tidy_after_forward_propagate_addr): Do
	not mark symbols for renaming.
	(forward_propagate_addr_expr): Match up push/pop_stmt_changes
	with the same statement, make sure to update the new pointed-to one.
	* tree-ssa-dce.c (eliminate_unnecessary_stmts): Do not copy
	call statements, do not mark symbols for renaming.
	* tree-ssa-operands.c (finalize_ssa_vdefs): Do not mark the VOP
	for renaming if a VDEF is removed but instead unlink that from
	the IL.

Index: gcc/tree-ssa-forwprop.c
===================================================================
*** gcc/tree-ssa-forwprop.c.orig	2009-01-12 11:59:23.000000000 +0100
--- gcc/tree-ssa-forwprop.c	2009-01-12 12:00:09.000000000 +0100
*************** tidy_after_forward_propagate_addr (gimpl
*** 586,593 ****
  
    if (TREE_CODE (gimple_assign_rhs1 (stmt)) == ADDR_EXPR)
       recompute_tree_invariant_for_addr_expr (gimple_assign_rhs1 (stmt));
- 
-   mark_symbols_for_renaming (stmt);
  }
  
  /* DEF_RHS contains the address of the 0th element in an array.
--- 586,591 ----
*************** forward_propagate_addr_expr (tree name,
*** 884,901 ****
  	  continue;
  	}
  
-       push_stmt_changes (&use_stmt);
- 
        {
  	gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
  	result = forward_propagate_addr_expr_1 (name, rhs, &gsi,
  						single_use_p);
! 	use_stmt = gsi_stmt (gsi);
        }
        all &= result;
  
-       pop_stmt_changes (&use_stmt);
- 
        /* Remove intermediate now unused copy and conversion chains.  */
        use_rhs = gimple_assign_rhs1 (use_stmt);
        if (result
--- 882,905 ----
  	  continue;
  	}
  
        {
  	gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
+ 	push_stmt_changes (&use_stmt);
  	result = forward_propagate_addr_expr_1 (name, rhs, &gsi,
  						single_use_p);
! 	/* If the use has moved to a different statement adjust
! 	   the update machinery.  */
! 	if (use_stmt != gsi_stmt (gsi))
! 	  {
! 	    pop_stmt_changes (&use_stmt);
! 	    use_stmt = gsi_stmt (gsi);
! 	    update_stmt (use_stmt);
! 	  }
! 	else
! 	  pop_stmt_changes (&use_stmt);
        }
        all &= result;
  
        /* Remove intermediate now unused copy and conversion chains.  */
        use_rhs = gimple_assign_rhs1 (use_stmt);
        if (result
Index: gcc/tree-ssa-dce.c
===================================================================
*** gcc/tree-ssa-dce.c.orig	2009-01-12 11:59:23.000000000 +0100
--- gcc/tree-ssa-dce.c	2009-01-12 12:00:09.000000000 +0100
*************** eliminate_unnecessary_stmts (void)
*** 692,698 ****
  	      if (call)
  		{
  		  tree name;
- 		  gimple g;
  
  		  /* When LHS of var = call (); is dead, simplify it into
  		     call (); saving one operand.  */
--- 692,697 ----
*************** eliminate_unnecessary_stmts (void)
*** 709,719 ****
  			}
  		      
  		      push_stmt_changes (gsi_stmt_ptr (&gsi));
! 		      g = gimple_copy (stmt);
! 		      gimple_call_set_lhs (g, NULL_TREE);
! 		      gsi_replace (&gsi, g, false);
! 		      maybe_clean_or_replace_eh_stmt (stmt, g);
! 		      mark_symbols_for_renaming (g);
  		      pop_stmt_changes (gsi_stmt_ptr (&gsi));
  		      release_ssa_name (name);
  		    }
--- 708,715 ----
  			}
  		      
  		      push_stmt_changes (gsi_stmt_ptr (&gsi));
! 		      gimple_call_set_lhs (stmt, NULL_TREE);
! 		      maybe_clean_or_replace_eh_stmt (stmt, stmt);
  		      pop_stmt_changes (gsi_stmt_ptr (&gsi));
  		      release_ssa_name (name);
  		    }
Index: gcc/tree-ssa-operands.c
===================================================================
*** gcc/tree-ssa-operands.c.orig	2009-01-12 11:59:23.000000000 +0100
--- gcc/tree-ssa-operands.c	2009-01-12 12:00:17.000000000 +0100
*************** finalize_ssa_vdefs (gimple stmt)
*** 856,868 ****
    /* If there is anything in the old list, free it.  */
    if (old_ops)
      {
        for (ptr = old_ops; ptr; ptr = last)
          {
  	  last = ptr->next;
  	  delink_imm_use (VDEF_OP_PTR (ptr, 0));
  	  add_vop_to_freelist (ptr);
  	}
-       mark_sym_for_renaming (gimple_vop (cfun));
      }
  
    /* Now set STMT's operands.  */
--- 856,868 ----
    /* If there is anything in the old list, free it.  */
    if (old_ops)
      {
+       unlink_stmt_vdef (stmt);
        for (ptr = old_ops; ptr; ptr = last)
          {
  	  last = ptr->next;
  	  delink_imm_use (VDEF_OP_PTR (ptr, 0));
  	  add_vop_to_freelist (ptr);
  	}
      }
  
    /* Now set STMT's operands.  */


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