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] Fix uses of TREE_INVARIANT in the middle-end


This fixes old uses of TREE_INVARIANT in the middle-end to use
is_gimple_min_invariant where appropriate.  This is a preparation
patch before removing the calls to recompute_tree_invariant_for_addr_expr.

Bootstrapped and tested on x86_64-unknown-linux-gnu, I'll apply this 
later.

Richard.

2008-03-20  Richard Guenther  <rguenther@suse.de>

	* tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop):
	Use is_gimple_min_invariant instead of TREE_INVARIANT.
	* tree-ssa-loop-ivopts.c (force_expr_to_var_cost): Likewise.
	* tree-ssa-dom.c (record_equality): Likewise.
	* tree-inline.c (copy_body_r): Likewise.
	* tree-ssa-pre.c (make_values_for_stmt): Remove test for
	TREE_INVARIANT.

Index: tree-scalar-evolution.c
===================================================================
*** tree-scalar-evolution.c	(revision 133391)
--- tree-scalar-evolution.c	(working copy)
*************** chrec_contains_symbols_defined_in_loop (
*** 360,366 ****
    if (chrec == NULL_TREE)
      return false;
  
!   if (TREE_INVARIANT (chrec))
      return false;
  
    if (TREE_CODE (chrec) == VAR_DECL
--- 360,366 ----
    if (chrec == NULL_TREE)
      return false;
  
!   if (is_gimple_min_invariant (chrec))
      return false;
  
    if (TREE_CODE (chrec) == VAR_DECL
Index: tree-ssa-loop-ivopts.c
===================================================================
*** tree-ssa-loop-ivopts.c	(revision 133391)
--- tree-ssa-loop-ivopts.c	(working copy)
*************** force_expr_to_var_cost (tree expr)
*** 3222,3228 ****
    if (SSA_VAR_P (expr))
      return zero_cost;
  
!   if (TREE_INVARIANT (expr))
      {
        if (TREE_CODE (expr) == INTEGER_CST)
  	return new_cost (integer_cost, 0);
--- 3222,3228 ----
    if (SSA_VAR_P (expr))
      return zero_cost;
  
!   if (is_gimple_min_invariant (expr))
      {
        if (TREE_CODE (expr) == INTEGER_CST)
  	return new_cost (integer_cost, 0);
Index: tree-ssa-dom.c
===================================================================
*** tree-ssa-dom.c	(revision 133391)
--- tree-ssa-dom.c	(working copy)
*************** record_equality (tree x, tree y)
*** 1146,1156 ****
       (by depth), then use that.
       Otherwise it doesn't matter which value we choose, just so
       long as we canonicalize on one value.  */
!   if (TREE_INVARIANT (y))
      ;
!   else if (TREE_INVARIANT (x) || (loop_depth_of_name (x) <= loop_depth_of_name (y)))
      prev_x = x, x = y, y = prev_x, prev_x = prev_y;
!   else if (prev_x && TREE_INVARIANT (prev_x))
      x = y, y = prev_x, prev_x = prev_y;
    else if (prev_y && TREE_CODE (prev_y) != VALUE_HANDLE)
      y = prev_y;
--- 1146,1157 ----
       (by depth), then use that.
       Otherwise it doesn't matter which value we choose, just so
       long as we canonicalize on one value.  */
!   if (is_gimple_min_invariant (y))
      ;
!   else if (is_gimple_min_invariant (x)
! 	   || (loop_depth_of_name (x) <= loop_depth_of_name (y)))
      prev_x = x, x = y, y = prev_x, prev_x = prev_y;
!   else if (prev_x && is_gimple_min_invariant (prev_x))
      x = y, y = prev_x, prev_x = prev_y;
    else if (prev_y && TREE_CODE (prev_y) != VALUE_HANDLE)
      y = prev_y;
Index: tree-ssa-pre.c
===================================================================
*** tree-ssa-pre.c	(revision 133391)
--- tree-ssa-pre.c	(working copy)
*************** make_values_for_stmt (tree stmt, basic_b
*** 3369,3375 ****
  	    && !SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs))
  	   || is_gimple_min_invariant (rhs)
  	   || TREE_CODE (rhs) == ADDR_EXPR
- 	   || TREE_INVARIANT (rhs)
  	   || DECL_P (rhs))
      {
  
--- 3369,3374 ----
Index: tree-inline.c
===================================================================
*** tree-inline.c	(revision 133391)
--- tree-inline.c	(working copy)
*************** copy_body_r (tree *tp, int *walk_subtree
*** 773,779 ****
  	 and friends are up-to-date.  */
        else if (TREE_CODE (*tp) == ADDR_EXPR)
  	{
! 	  int invariant = TREE_INVARIANT (*tp);
  	  walk_tree (&TREE_OPERAND (*tp, 0), copy_body_r, id, NULL);
  	  /* Handle the case where we substituted an INDIRECT_REF
  	     into the operand of the ADDR_EXPR.  */
--- 773,779 ----
  	 and friends are up-to-date.  */
        else if (TREE_CODE (*tp) == ADDR_EXPR)
  	{
! 	  int invariant = is_gimple_min_invariant (*tp);
  	  walk_tree (&TREE_OPERAND (*tp, 0), copy_body_r, id, NULL);
  	  /* Handle the case where we substituted an INDIRECT_REF
  	     into the operand of the ADDR_EXPR.  */
*************** copy_body_r (tree *tp, int *walk_subtree
*** 783,789 ****
  	    recompute_tree_invariant_for_addr_expr (*tp);
  	  /* If this used to be invariant, but is not any longer,
  	     then regimplification is probably needed.  */
! 	  if (invariant && !TREE_INVARIANT (*tp))
  	    id->regimplify = true;
  	  *walk_subtrees = 0;
  	}
--- 783,789 ----
  	    recompute_tree_invariant_for_addr_expr (*tp);
  	  /* If this used to be invariant, but is not any longer,
  	     then regimplification is probably needed.  */
! 	  if (invariant && !is_gimple_min_invariant (*tp))
  	    id->regimplify = true;
  	  *walk_subtrees = 0;
  	}


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