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] Rename tree_ssa_useless_type_conversion_1 to useless_type_conversion_p


As discussed.

Re-bootstrapped on i686-pc-linux-gnu, applied to mainline.

Richard.

2007-06-22  Richard Guenther  <rguenther@suse.de>

	* tree-flow.h (tree_ssa_useless_type_conversion_1): Rename to ...
	(useless_type_conversion_p): ... this.
	* tree-ssa.c (tree_ssa_useless_type_conversion_1): Rename to ...
	(useless_type_conversion_p): ... this.
	* builtins.c (fold_builtin_memory_op): Rename
	tree_ssa_useless_type_conversion_1 to useless_type_conversion_p.
	* tree-cfg.c (verify_expr): Likewise.
	* tree-ssa-address.c (tree_ssa_useless_type_conversion_1): Likewise.
	* tree-ssa-ccp.c (ccp_fold): Likewise.
	* tree-ssa-copy.c (may_propagate_copy): Likewise.
	* tree-ssa-dom.c (eliminate_redundant_computations): Likewise.
	* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Likewise.
	* tree-ssa-loop-niter.c (refine_bounds_using_guard): Likewise.
	* tree-ssa-pre.c (eliminate): Likewise.
	* tree-ssa.c (delete_tree_ssa): Likewise.
	(tree_ssa_useless_type_conversion): Likewise.
	* tree.c (build2_stat): Likewise.

Index: gcc/builtins.c
===================================================================
*** gcc.orig/builtins.c	2007-06-26 21:58:18.000000000 +0200
--- gcc/builtins.c	2007-06-26 22:02:16.000000000 +0200
*************** fold_builtin_memory_op (tree dest, tree 
*** 8584,8590 ****
  
        if (srctype == desttype
  	  || (gimple_in_ssa_p (cfun)
! 	      && tree_ssa_useless_type_conversion_1 (desttype, srctype)))
  	expr = srcvar;
        else if ((INTEGRAL_TYPE_P (TREE_TYPE (srcvar))
  	   || POINTER_TYPE_P (TREE_TYPE (srcvar)))
--- 8584,8590 ----
  
        if (srctype == desttype
  	  || (gimple_in_ssa_p (cfun)
! 	      && useless_type_conversion_p (desttype, srctype)))
  	expr = srcvar;
        else if ((INTEGRAL_TYPE_P (TREE_TYPE (srcvar))
  	   || POINTER_TYPE_P (TREE_TYPE (srcvar)))
Index: gcc/tree-cfg.c
===================================================================
*** gcc.orig/tree-cfg.c	2007-06-26 21:58:18.000000000 +0200
--- gcc/tree-cfg.c	2007-06-26 22:02:16.000000000 +0200
*************** verify_expr (tree *tp, int *walk_subtree
*** 3287,3294 ****
  	}
        /* Check to make sure the second operand is an integer with type of
  	 sizetype.  */
!       if (!tree_ssa_useless_type_conversion_1 (sizetype,
! 					       TREE_TYPE (TREE_OPERAND (t, 1))))
  	{
  	  error ("invalid operand to pointer plus, second operand is not an "
  		 "integer with type of sizetype.");
--- 3287,3294 ----
  	}
        /* Check to make sure the second operand is an integer with type of
  	 sizetype.  */
!       if (!useless_type_conversion_p (sizetype,
! 				     TREE_TYPE (TREE_OPERAND (t, 1))))
  	{
  	  error ("invalid operand to pointer plus, second operand is not an "
  		 "integer with type of sizetype.");
Index: gcc/tree-flow.h
===================================================================
*** gcc.orig/tree-flow.h	2007-06-26 21:58:18.000000000 +0200
--- gcc/tree-flow.h	2007-06-26 22:02:16.000000000 +0200
*************** extern void init_tree_ssa (void);
*** 868,874 ****
  extern edge ssa_redirect_edge (edge, basic_block);
  extern void flush_pending_stmts (edge);
  extern bool tree_ssa_useless_type_conversion (tree);
! extern bool tree_ssa_useless_type_conversion_1 (tree, tree);
  extern void verify_ssa (bool);
  extern void delete_tree_ssa (void);
  extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
--- 868,874 ----
  extern edge ssa_redirect_edge (edge, basic_block);
  extern void flush_pending_stmts (edge);
  extern bool tree_ssa_useless_type_conversion (tree);
! extern bool useless_type_conversion_p (tree, tree);
  extern void verify_ssa (bool);
  extern void delete_tree_ssa (void);
  extern void walk_use_def_chains (tree, walk_use_def_chains_fn, void *, bool);
Index: gcc/tree-predcom.c
===================================================================
*** gcc.orig/tree-predcom.c	2007-06-26 21:58:18.000000000 +0200
--- gcc/tree-predcom.c	2007-06-26 22:02:16.000000000 +0200
*************** determine_offset (struct data_reference 
*** 633,639 ****
    /* Check that both the references access the location in the same type.  */
    typea = TREE_TYPE (DR_REF (a));
    typeb = TREE_TYPE (DR_REF (b));
!   if (!tree_ssa_useless_type_conversion_1 (typeb, typea))
      return false;
  
    /* Check whether the base address and the step of both references is the
--- 633,639 ----
    /* Check that both the references access the location in the same type.  */
    typea = TREE_TYPE (DR_REF (a));
    typeb = TREE_TYPE (DR_REF (b));
!   if (!useless_type_conversion_p (typeb, typea))
      return false;
  
    /* Check whether the base address and the step of both references is the
Index: gcc/tree-ssa-address.c
===================================================================
*** gcc.orig/tree-ssa-address.c	2007-06-26 21:58:18.000000000 +0200
--- gcc/tree-ssa-address.c	2007-06-26 22:02:16.000000000 +0200
*************** create_mem_ref (block_stmt_iterator *bsi
*** 604,610 ****
        /* Add the symbol to base, eventually forcing it to register.  */
        if (parts.base)
  	{
! 	  gcc_assert (tree_ssa_useless_type_conversion_1
  				(sizetype, TREE_TYPE (parts.base)));
  
  	  if (parts.index)
--- 604,610 ----
        /* Add the symbol to base, eventually forcing it to register.  */
        if (parts.base)
  	{
! 	  gcc_assert (useless_type_conversion_p
  				(sizetype, TREE_TYPE (parts.base)));
  
  	  if (parts.index)
Index: gcc/tree-ssa-ccp.c
===================================================================
*** gcc.orig/tree-ssa-ccp.c	2007-06-26 21:58:18.000000000 +0200
--- gcc/tree-ssa-ccp.c	2007-06-26 22:02:16.000000000 +0200
*************** ccp_fold (tree stmt)
*** 899,906 ****
  	}
  
        if ((code == NOP_EXPR || code == CONVERT_EXPR)
! 	  && tree_ssa_useless_type_conversion_1 (TREE_TYPE (rhs),
! 		  				 TREE_TYPE (op0)))
  	return op0;
        return fold_unary (code, TREE_TYPE (rhs), op0);
      }
--- 899,905 ----
  	}
  
        if ((code == NOP_EXPR || code == CONVERT_EXPR)
! 	  && useless_type_conversion_p (TREE_TYPE (rhs), TREE_TYPE (op0)))
  	return op0;
        return fold_unary (code, TREE_TYPE (rhs), op0);
      }
Index: gcc/tree-ssa-copy.c
===================================================================
*** gcc.orig/tree-ssa-copy.c	2007-06-26 21:58:18.000000000 +0200
--- gcc/tree-ssa-copy.c	2007-06-26 22:02:16.000000000 +0200
*************** may_propagate_copy (tree dest, tree orig
*** 82,88 ****
  	                         DECL_UID (SSA_NAME_VAR (dest)))));
    
    /* Do not copy between types for which we *do* need a conversion.  */
!   if (!tree_ssa_useless_type_conversion_1 (type_d, type_o))
      return false;
  
    /* FIXME.  GIMPLE is allowing pointer assignments and comparisons of
--- 82,88 ----
  	                         DECL_UID (SSA_NAME_VAR (dest)))));
    
    /* Do not copy between types for which we *do* need a conversion.  */
!   if (!useless_type_conversion_p (type_d, type_o))
      return false;
  
    /* FIXME.  GIMPLE is allowing pointer assignments and comparisons of
Index: gcc/tree-ssa-dom.c
===================================================================
*** gcc.orig/tree-ssa-dom.c	2007-06-26 21:58:18.000000000 +0200
--- gcc/tree-ssa-dom.c	2007-06-26 22:02:16.000000000 +0200
*************** eliminate_redundant_computations (tree s
*** 1515,1522 ****
    if (cached_lhs
        && ((TREE_CODE (cached_lhs) != SSA_NAME
  	   && (modify_expr_p
! 	       || tree_ssa_useless_type_conversion_1 (TREE_TYPE (*expr_p),
! 						      TREE_TYPE (cached_lhs))))
  	  || may_propagate_copy (*expr_p, cached_lhs)))
      {
        if (dump_file && (dump_flags & TDF_DETAILS))
--- 1515,1522 ----
    if (cached_lhs
        && ((TREE_CODE (cached_lhs) != SSA_NAME
  	   && (modify_expr_p
! 	       || useless_type_conversion_p (TREE_TYPE (*expr_p),
! 					    TREE_TYPE (cached_lhs))))
  	  || may_propagate_copy (*expr_p, cached_lhs)))
      {
        if (dump_file && (dump_flags & TDF_DETAILS))
*************** eliminate_redundant_computations (tree s
*** 1541,1548 ****
  	retval = true;
        
        if (modify_expr_p
! 	  && !tree_ssa_useless_type_conversion_1 (TREE_TYPE (*expr_p),
! 						  TREE_TYPE (cached_lhs)))
  	cached_lhs = fold_convert (TREE_TYPE (*expr_p), cached_lhs);
  
        propagate_tree_value (expr_p, cached_lhs);
--- 1541,1548 ----
  	retval = true;
        
        if (modify_expr_p
! 	  && !useless_type_conversion_p (TREE_TYPE (*expr_p),
! 				        TREE_TYPE (cached_lhs)))
  	cached_lhs = fold_convert (TREE_TYPE (*expr_p), cached_lhs);
  
        propagate_tree_value (expr_p, cached_lhs);
Index: gcc/tree-ssa-forwprop.c
===================================================================
*** gcc.orig/tree-ssa-forwprop.c	2007-06-26 21:58:18.000000000 +0200
--- gcc/tree-ssa-forwprop.c	2007-06-26 22:02:16.000000000 +0200
*************** forward_propagate_addr_expr_1 (tree name
*** 601,608 ****
        	    && rhs == name)
  	   || ((TREE_CODE (rhs) == NOP_EXPR
  		|| TREE_CODE (rhs) == CONVERT_EXPR)
! 	       && tree_ssa_useless_type_conversion_1 (TREE_TYPE (rhs),
! 						      TREE_TYPE (def_rhs))))
      return forward_propagate_addr_expr (lhs, def_rhs);
  
    /* Strip away any outer COMPONENT_REF, ARRAY_REF or ADDR_EXPR
--- 601,608 ----
        	    && rhs == name)
  	   || ((TREE_CODE (rhs) == NOP_EXPR
  		|| TREE_CODE (rhs) == CONVERT_EXPR)
! 	       && useless_type_conversion_p (TREE_TYPE (rhs),
! 					    TREE_TYPE (def_rhs))))
      return forward_propagate_addr_expr (lhs, def_rhs);
  
    /* Strip away any outer COMPONENT_REF, ARRAY_REF or ADDR_EXPR
Index: gcc/tree-ssa-loop-niter.c
===================================================================
*** gcc.orig/tree-ssa-loop-niter.c	2007-06-26 21:58:18.000000000 +0200
--- gcc/tree-ssa-loop-niter.c	2007-06-26 22:02:16.000000000 +0200
*************** refine_bounds_using_guard (tree type, tr
*** 213,219 ****
        STRIP_SIGN_NOPS (c0);
        STRIP_SIGN_NOPS (c1);
        ctype = TREE_TYPE (c0);
!       if (!tree_ssa_useless_type_conversion_1 (ctype, type))
  	return;
  
        break;
--- 213,219 ----
        STRIP_SIGN_NOPS (c0);
        STRIP_SIGN_NOPS (c1);
        ctype = TREE_TYPE (c0);
!       if (!useless_type_conversion_p (ctype, type))
  	return;
  
        break;
Index: gcc/tree-ssa-pre.c
===================================================================
*** gcc.orig/tree-ssa-pre.c	2007-06-26 21:58:18.000000000 +0200
--- gcc/tree-ssa-pre.c	2007-06-26 22:02:16.000000000 +0200
*************** eliminate (void)
*** 3588,3595 ****
  		     which may require adding a simple cast, which fold_convert
  		     will do for us.  */
  		  if (TREE_CODE (*rhs_p) != SSA_NAME
! 		      && !tree_ssa_useless_type_conversion_1 (TREE_TYPE (*rhs_p),
! 							      TREE_TYPE (sprime)))
  		    sprime = fold_convert (TREE_TYPE (*rhs_p), sprime);
  
  		  pre_stats.eliminations++;
--- 3588,3595 ----
  		     which may require adding a simple cast, which fold_convert
  		     will do for us.  */
  		  if (TREE_CODE (*rhs_p) != SSA_NAME
! 		      && !useless_type_conversion_p (TREE_TYPE (*rhs_p),
! 						    TREE_TYPE (sprime)))
  		    sprime = fold_convert (TREE_TYPE (*rhs_p), sprime);
  
  		  pre_stats.eliminations++;
Index: gcc/tree-ssa.c
===================================================================
*** gcc.orig/tree-ssa.c	2007-06-26 21:58:18.000000000 +0200
--- gcc/tree-ssa.c	2007-06-26 22:02:16.000000000 +0200
*************** delete_tree_ssa (void)
*** 891,897 ****
     useless type conversion, otherwise return false.  */
  
  bool
! tree_ssa_useless_type_conversion_1 (tree outer_type, tree inner_type)
  {
    if (inner_type == outer_type)
      return true;
--- 891,897 ----
     useless type conversion, otherwise return false.  */
  
  bool
! useless_type_conversion_p (tree outer_type, tree inner_type)
  {
    if (inner_type == outer_type)
      return true;
*************** tree_ssa_useless_type_conversion_1 (tree
*** 964,970 ****
    /* Recurse for complex types.  */
    else if (TREE_CODE (inner_type) == COMPLEX_TYPE
  	   && TREE_CODE (outer_type) == COMPLEX_TYPE
! 	   && tree_ssa_useless_type_conversion_1 (TREE_TYPE (outer_type),
  						  TREE_TYPE (inner_type)))
      return true;
  
--- 964,970 ----
    /* Recurse for complex types.  */
    else if (TREE_CODE (inner_type) == COMPLEX_TYPE
  	   && TREE_CODE (outer_type) == COMPLEX_TYPE
! 	   && useless_type_conversion_p (TREE_TYPE (outer_type),
  						  TREE_TYPE (inner_type)))
      return true;
  
*************** tree_ssa_useless_type_conversion (tree e
*** 987,993 ****
      /* FIXME: Use of GENERIC_TREE_TYPE here is a temporary measure to work
         around known bugs with GIMPLE_MODIFY_STMTs appearing in places
         they shouldn't.  See PR 30391.  */
!     return tree_ssa_useless_type_conversion_1
        (TREE_TYPE (expr),
         GENERIC_TREE_TYPE (TREE_OPERAND (expr, 0)));
  
--- 987,993 ----
      /* FIXME: Use of GENERIC_TREE_TYPE here is a temporary measure to work
         around known bugs with GIMPLE_MODIFY_STMTs appearing in places
         they shouldn't.  See PR 30391.  */
!     return useless_type_conversion_p
        (TREE_TYPE (expr),
         GENERIC_TREE_TYPE (TREE_OPERAND (expr, 0)));
  
Index: gcc/tree.c
===================================================================
*** gcc.orig/tree.c	2007-06-26 21:58:18.000000000 +0200
--- gcc/tree.c	2007-06-26 22:02:16.000000000 +0200
*************** build2_stat (enum tree_code code, tree t
*** 3076,3083 ****
    if (code == POINTER_PLUS_EXPR && arg0 && arg1 && tt)
      gcc_assert (POINTER_TYPE_P (tt) && POINTER_TYPE_P (TREE_TYPE (arg0))
  		&& TREE_CODE (TREE_TYPE (arg1)) == INTEGER_TYPE
! 		&& tree_ssa_useless_type_conversion_1 (sizetype,
! 						       TREE_TYPE (arg1)));
  
    t = make_node_stat (code PASS_MEM_STAT);
    TREE_TYPE (t) = tt;
--- 3076,3082 ----
    if (code == POINTER_PLUS_EXPR && arg0 && arg1 && tt)
      gcc_assert (POINTER_TYPE_P (tt) && POINTER_TYPE_P (TREE_TYPE (arg0))
  		&& TREE_CODE (TREE_TYPE (arg1)) == INTEGER_TYPE
! 		&& useless_type_conversion_p (sizetype, TREE_TYPE (arg1)));
  
    t = make_node_stat (code PASS_MEM_STAT);
    TREE_TYPE (t) = tt;


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