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 to gimplify_modify_expr to avoid extra copies


This patch should help to avoid the extra copies kenner has been seeing.

Brian, can you make sure that my comment about V_MAY_DEF is accurate when
you check in your patch?  :)

Tested x86_64-pc-linux-gnu, applied to trunk.

2004-06-10  Jason Merrill  <jason@redhat.com>

	* gimplify.c (gimplify_modify_expr): Don't force a temporary
	of an aggregate_value_p type.

*** gimplify.c.~1~	2004-06-10 16:27:29.000000000 -0400
--- gimplify.c	2004-06-10 22:54:18.000000000 -0400
*************** gimplify_modify_expr (tree *expr_p, tree
*** 2493,2504 ****
  
  	 FIXME this should be handled by the is_gimple_rhs predicate.  */
  
!       if (TREE_CODE (*from_p) == CALL_EXPR
! 	  || (flag_non_call_exceptions && tree_could_trap_p (*from_p))
! 	  /* If we're dealing with a renamable type, either source or dest
! 	     must be a renamed variable.  */
! 	  || (is_gimple_reg_type (TREE_TYPE (*from_p))
! 	      && !is_gimple_reg (*to_p)))
  	gimplify_expr (from_p, pre_p, post_p, is_gimple_val, fb_rvalue);
  
        /* If the value being copied is of variable width, expose the length
--- 2493,2508 ----
  
  	 FIXME this should be handled by the is_gimple_rhs predicate.  */
  
!       if (aggregate_value_p (TREE_TYPE (*from_p), NULL_TREE))
! 	/* Don't force a temp of a large aggregate type; the copy could be
! 	   arbitrarily expensive.  Instead we will generate a V_MAY_DEF for
! 	   the assignment.  */;
!       else if (TREE_CODE (*from_p) == CALL_EXPR
! 	       || (flag_non_call_exceptions && tree_could_trap_p (*from_p))
! 	       /* If we're dealing with a renamable type, either source or dest
! 		  must be a renamed variable.  */
! 	       || (is_gimple_reg_type (TREE_TYPE (*from_p))
! 		   && !is_gimple_reg (*to_p)))
  	gimplify_expr (from_p, pre_p, post_p, is_gimple_val, fb_rvalue);
  
        /* If the value being copied is of variable width, expose the length

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