This is the mail archive of the gcc@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]

Re: Regression for trunk on i686-pc-linux-gnu


On Tue, Jul 27, 2004 at 05:50:20PM -0400, Richard Kenner wrote:
>     Why exactly did allowing INDIRECT_REF in is_gimple_addr_expr_arg make
>     this test pass?
> 
> I have no clue.  I haven't tried to analyze that yet and am not sure where
> to look.

Because sra_walk_modify_expr uses is_gimple_addr_expr_arg as part
of algorithm selection.  So the change to is_gimple_addr_expr_arg
that removed INDIRECT_REF changed its behaviour.

Having looked at the various uses of is_gimple_addr_expr_arg, I'm
of the opinion that INDIRECT_REF should be added back to it.  Every
place uses build_fold_addr_expr, or the equivalent, which does fold
away the INDIRECT_REF immediately.

I'm testing the following patch.


r~



	* gimplify.c (is_gimple_addr_expr_arg_or_indirect): Remove.
	(gimplify_addr_expr): Use is_gimple_addr_expr_arg instead.
	* tree-gimple.c (is_gimple_addr_expr_arg): Accept INDIRECT_REF.
	(is_gimple_lvalue): Don't check for INDIRECT_REF directly.
	(GRAMMAR): Update to match.

Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimplify.c,v
retrieving revision 2.54
diff -c -p -d -r2.54 gimplify.c
*** gimplify.c	24 Jul 2004 01:29:11 -0000	2.54
--- gimplify.c	27 Jul 2004 23:00:36 -0000
*************** gimplify_modify_expr_rhs (tree *expr_p, 
*** 2709,2723 ****
    return ret;
  }
  
- /* Return true if T is either a valid GIMPLE operand or is an
-    INDIRECT_REF (the latter is valid since we'll strip it off).  */
- 
- static bool
- is_gimple_addr_expr_arg_or_indirect (tree t)
- {
-   return (TREE_CODE (t) == INDIRECT_REF || is_gimple_addr_expr_arg (t));
- }
- 
  /* Gimplify the MODIFY_EXPR node pointed by EXPR_P.
  
        modify_expr
--- 2709,2714 ----
*************** gimplify_addr_expr (tree *expr_p, tree *
*** 3027,3033 ****
        /* We use fb_either here because the C frontend sometimes takes
  	 the address of a call that returns a struct.  */
        ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, post_p,
! 			   is_gimple_addr_expr_arg_or_indirect, fb_either);
        if (ret != GS_ERROR)
  	{
  	  /* The above may have made an INDIRECT ref (e.g, Ada's NULL_EXPR),
--- 3018,3024 ----
        /* We use fb_either here because the C frontend sometimes takes
  	 the address of a call that returns a struct.  */
        ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, post_p,
! 			   is_gimple_addr_expr_arg, fb_either);
        if (ret != GS_ERROR)
  	{
  	  /* The above may have made an INDIRECT ref (e.g, Ada's NULL_EXPR),
Index: tree-gimple.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-gimple.c,v
retrieving revision 2.18
diff -c -p -d -r2.18 tree-gimple.c
*** tree-gimple.c	24 Jul 2004 01:29:11 -0000	2.18
--- tree-gimple.c	27 Jul 2004 23:00:37 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 115,125 ****
     call-arg-list: TREE_LIST
  			members -> lhs
  
!    addr-expr-arg: ID
  		| compref
  
!    with-size-arg: addr-expr-arg
  		| indirectref
  		| call-stmt
  
     indirectref	: INDIRECT_REF
--- 115,127 ----
     call-arg-list: TREE_LIST
  			members -> lhs
  
!    addr-expr-arg-no-ind: ID
  		| compref
  
!    addr-expr-arg: addr-expr-arg-no-ind
  		| indirectref
+ 
+    with-size-arg: addr-expr-arg
  		| call-stmt
  
     indirectref	: INDIRECT_REF
*************** Boston, MA 02111-1307, USA.  */
*** 127,133 ****
  
     lhs		: addr-expr-arg
  		| bitfieldref
- 		| indirectref
  		| WITH_SIZE_EXPR
  			op0 -> with-size-arg
  			op1 -> val
--- 129,134 ----
*************** Boston, MA 02111-1307, USA.  */
*** 176,182 ****
  		| CONST
  		| call-stmt
  		| ADDR_EXPR
! 			op0 -> addr-expr-arg
  		| UNOP
  			op0 -> val
  		| BINOP
--- 177,183 ----
  		| CONST
  		| call-stmt
  		| ADDR_EXPR
! 			op0 -> addr-expr-arg-no-ind
  		| UNOP
  			op0 -> val
  		| BINOP
*************** bool
*** 301,307 ****
  is_gimple_lvalue (tree t)
  {
    return (is_gimple_addr_expr_arg (t)
- 	  || TREE_CODE (t) == INDIRECT_REF
  	  || TREE_CODE (t) == WITH_SIZE_EXPR
  	  /* These are complex lvalues, but don't have addresses, so they
  	     go here.  */
--- 302,307 ----
*************** bool
*** 323,329 ****
  is_gimple_addr_expr_arg (tree t)
  {
    return (is_gimple_id (t) || handled_component_p (t)
! 	  || TREE_CODE (t) == REALPART_EXPR || TREE_CODE (t) == IMAGPART_EXPR);
  }
  
  /* Return true if T is function invariant.  Or rather a restricted
--- 323,331 ----
  is_gimple_addr_expr_arg (tree t)
  {
    return (is_gimple_id (t) || handled_component_p (t)
! 	  || TREE_CODE (t) == REALPART_EXPR
! 	  || TREE_CODE (t) == IMAGPART_EXPR
! 	  || TREE_CODE (t) == INDIRECT_REF);
  }
  
  /* Return true if T is function invariant.  Or rather a restricted


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