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] Address parts of Diegos review


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

Richard.

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

	* tree-ssa-dse.c (dse_possible_dead_store_p): Use
	ref_maybe_used_by_stmt_p.
	* tree-ssa-ccp.c (likely_value): Add comment, skip static-chain
	of call statements.
	* tree-ssa-alias.c (ref_may_used_by_call_p): Rename to ...
	(ref_maybe_used_by_call_p): ... this.
	(ref_may_used_by_stmt_p): Rename to ...
	(ref_maybe_used_by_stmt_p): ... this.  Adjust.
	(maybe_skip_until): Fix comment.
	* tree-ssa-alias.h (ref_may_used_by_stmt_p): Rename to ...
	(ref_maybe_used_by_stmt_p): ... this.
	* tree-ssa.c (verify_ssa): Fix typo.

Index: gcc/tree-ssa-dse.c
===================================================================
*** gcc/tree-ssa-dse.c	(revision 143819)
--- gcc/tree-ssa-dse.c	(working copy)
*************** dse_possible_dead_store_p (gimple stmt, 
*** 183,189 ****
  	    }
  
  	  /* If the statement is a use the store is not dead.  */
! 	  if (ref_may_used_by_stmt_p (use_stmt, gimple_assign_lhs (stmt)))
  	    {
  	      fail = true;
  	      BREAK_FROM_IMM_USE_STMT (ui);
--- 183,189 ----
  	    }
  
  	  /* If the statement is a use the store is not dead.  */
! 	  if (ref_maybe_used_by_stmt_p (use_stmt, gimple_assign_lhs (stmt)))
  	    {
  	      fail = true;
  	      BREAK_FROM_IMM_USE_STMT (ui);
Index: gcc/tree-ssa-ccp.c
===================================================================
*** gcc/tree-ssa-ccp.c	(revision 143819)
--- gcc/tree-ssa-ccp.c	(working copy)
*************** likely_value (gimple stmt)
*** 525,532 ****
  	has_constant_operand = true;
      }
  
!   /* There may be constants in regular rhs operands.  */
!   for (i = is_gimple_call (stmt) + gimple_has_lhs (stmt);
         i < gimple_num_ops (stmt); ++i)
      {
        tree op = gimple_op (stmt, i);
--- 525,534 ----
  	has_constant_operand = true;
      }
  
!   /* There may be constants in regular rhs operands.  For calls we
!      have to ignore lhs, fndecl and static chain, otherwise only
!      the lhs.  */
!   for (i = (is_gimple_call (stmt) ? 2 : 0) + gimple_has_lhs (stmt);
         i < gimple_num_ops (stmt); ++i)
      {
        tree op = gimple_op (stmt, i);
Index: gcc/tree-ssa-alias.c
===================================================================
*** gcc/tree-ssa-alias.c	(revision 143819)
--- gcc/tree-ssa-alias.c	(working copy)
*************** refs_may_alias_p (tree ref1, tree ref2)
*** 578,584 ****
     otherwise return false.  */
  
  static bool
! ref_may_used_by_call_p (gimple call, tree ref)
  {
    tree base = get_base_address (ref);
    unsigned i;
--- 578,584 ----
     otherwise return false.  */
  
  static bool
! ref_maybe_used_by_call_p (gimple call, tree ref)
  {
    tree base = get_base_address (ref);
    unsigned i;
*************** ref_may_used_by_call_p (gimple call, tre
*** 635,641 ****
     true, otherwise return false.  */
  
  bool
! ref_may_used_by_stmt_p (gimple stmt, tree ref)
  {
    if (is_gimple_assign (stmt))
      {
--- 635,641 ----
     true, otherwise return false.  */
  
  bool
! ref_maybe_used_by_stmt_p (gimple stmt, tree ref)
  {
    if (is_gimple_assign (stmt))
      {
*************** ref_may_used_by_stmt_p (gimple stmt, tre
*** 654,660 ****
        return refs_may_alias_p (rhs, ref);
      }
    else if (is_gimple_call (stmt))
!     return ref_may_used_by_call_p (stmt, ref);
  
    return true;
  }
--- 654,660 ----
        return refs_may_alias_p (rhs, ref);
      }
    else if (is_gimple_call (stmt))
!     return ref_maybe_used_by_call_p (stmt, ref);
  
    return true;
  }
*************** maybe_skip_until (gimple phi, tree targe
*** 766,772 ****
  
  /* Starting from a PHI node for the virtual operand of the memory reference
     REF find a continuation virtual operand that allows to continue walking
!    statements dominating PHI skipping only statements that do not possibly
     clobber REF.  Returns NULL_TREE if no suitable virtual operand can
     be found.  */
  
--- 766,772 ----
  
  /* Starting from a PHI node for the virtual operand of the memory reference
     REF find a continuation virtual operand that allows to continue walking
!    statements dominating PHI skipping only statements that cannot possibly
     clobber REF.  Returns NULL_TREE if no suitable virtual operand can
     be found.  */
  
Index: gcc/tree-ssa-alias.h
===================================================================
*** gcc/tree-ssa-alias.h	(revision 143819)
--- gcc/tree-ssa-alias.h	(working copy)
*************** extern bool may_point_to_global_var (tre
*** 83,89 ****
  extern bool may_point_to_decl (tree, tree);
  extern bool may_point_to_same_object (tree, tree);
  extern bool refs_may_alias_p (tree, tree);
! extern bool ref_may_used_by_stmt_p (gimple, tree);
  extern bool stmt_may_clobber_ref_p (gimple, tree);
  extern void *walk_non_aliased_vuses (tree, tree,
  				     void *(*)(tree, tree, void *), void *);
--- 83,89 ----
  extern bool may_point_to_decl (tree, tree);
  extern bool may_point_to_same_object (tree, tree);
  extern bool refs_may_alias_p (tree, tree);
! extern bool ref_maybe_used_by_stmt_p (gimple, tree);
  extern bool stmt_may_clobber_ref_p (gimple, tree);
  extern void *walk_non_aliased_vuses (tree, tree,
  				     void *(*)(tree, tree, void *), void *);
Index: gcc/tree-ssa.c
===================================================================
*** gcc/tree-ssa.c	(revision 143820)
--- gcc/tree-ssa.c	(working copy)
*************** verify_ssa (bool check_modified_stmt)
*** 643,649 ****
  	    {
  	      if  (gimple_vuse_op (stmt) == NULL_USE_OPERAND_P)
  		{
! 		  error ("statement has VUSE operand not in usess list");
  		  has_err = true;
  		}
  	      has_err |= verify_ssa_name (gimple_vuse (stmt), true);
--- 643,649 ----
  	    {
  	      if  (gimple_vuse_op (stmt) == NULL_USE_OPERAND_P)
  		{
! 		  error ("statement has VUSE operand not in uses list");
  		  has_err = true;
  		}
  	      has_err |= verify_ssa_name (gimple_vuse (stmt), true);


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