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][tuples] Fix ICEs in SRA


This fixes ICEs seen for ptrmem6.C on i686 and ppc64.  The tuplification
of sra_walk_gimple_assign was not handling the "real" SRA constraints
correctly.

I'll commit this after testing.

Richard.

2008-07-24  Richard Guenther  <rguenther@suse.de>

	* tree-sra.c (sra_walk_expr): Also handle CONVERT_EXPR.
	(sra_walk_gimple_assign): Correctly detect assigns we can handle.

Index: gcc/tree-sra.c
===================================================================
*** gcc/tree-sra.c	(revision 138114)
--- gcc/tree-sra.c	(working copy)
*************** sra_walk_expr (tree *expr_p, gimple_stmt
*** 882,887 ****
--- 882,888 ----
  	goto use_all;
  
        case NOP_EXPR:
+       case CONVERT_EXPR:
  	/* Similarly, a nop explicitly wants to look at an object in a
  	   type other than the one we've scalarized.  */
  	goto use_all;
*************** sra_walk_gimple_assign (gimple stmt, gim
*** 955,973 ****
  			const struct sra_walk_fns *fns)
  {
    struct sra_elt *lhs_elt = NULL, *rhs_elt = NULL;
!   tree lhs, rhs, rhs2;
! 
!   lhs = gimple_assign_lhs (stmt);
!   rhs = gimple_assign_rhs1 (stmt);
!   rhs2 = gimple_assign_rhs2 (stmt);
  
    /* If there is more than 1 element on the RHS, only walk the lhs.  */
!   if (rhs2)
      {
        sra_walk_expr (gimple_assign_lhs_ptr (stmt), gsi, true, fns);
        return;
      }
  
    lhs_elt = maybe_lookup_element_for_expr (lhs);
    rhs_elt = maybe_lookup_element_for_expr (rhs);
  
--- 956,972 ----
  			const struct sra_walk_fns *fns)
  {
    struct sra_elt *lhs_elt = NULL, *rhs_elt = NULL;
!   tree lhs, rhs;
  
    /* If there is more than 1 element on the RHS, only walk the lhs.  */
!   if (!gimple_assign_single_p (stmt))
      {
        sra_walk_expr (gimple_assign_lhs_ptr (stmt), gsi, true, fns);
        return;
      }
  
+   lhs = gimple_assign_lhs (stmt);
+   rhs = gimple_assign_rhs1 (stmt);
    lhs_elt = maybe_lookup_element_for_expr (lhs);
    rhs_elt = maybe_lookup_element_for_expr (rhs);
  
*************** sra_walk_gimple_assign (gimple stmt, gim
*** 997,1003 ****
  
    /* Likewise, handle the LHS being scalarizable.  We have cases similar
       to those above, but also want to handle RHS being constant.  */
!   if (lhs_elt && !rhs2)
      {
        /* If this is an assignment from a constant, or constructor, then
  	 we have access to all of the elements individually.  Invoke INIT.  */
--- 996,1002 ----
  
    /* Likewise, handle the LHS being scalarizable.  We have cases similar
       to those above, but also want to handle RHS being constant.  */
!   if (lhs_elt)
      {
        /* If this is an assignment from a constant, or constructor, then
  	 we have access to all of the elements individually.  Invoke INIT.  */


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