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 PR42805


I'm going to bootstrap & test the following patch which addresses
the issue that SRA ends up introducing new accesses to DECLs with
DECL_HAS_VALUE_EXPR_P set.

Martin, does this look ok?  David - can you test this on hppa
(I verified the testcase no longer ICEs with a cross and the patch).

Thanks,
Richard.

2010-03-01  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42805
	* tree-sra.c (build_access_from_expr_1): Ignore decls with
	value-exprs.
	(sra_modify_assign): Do not look through to decls with
	value-exprs.

Index: gcc/tree-sra.c
===================================================================
*** gcc/tree-sra.c	(revision 157134)
--- gcc/tree-sra.c	(working copy)
*************** build_access_from_expr_1 (tree *expr_ptr
*** 897,902 ****
--- 897,910 ----
    tree expr = *expr_ptr;
    bool partial_ref;
  
+   if ((TREE_CODE (expr) == VAR_DECL
+        || TREE_CODE (expr) == PARM_DECL)
+       && DECL_HAS_VALUE_EXPR_P (expr))
+     {
+       disqualify_candidate (expr, "decl with a value-expression.");
+       return NULL;
+     }
+ 
    if (TREE_CODE (expr) == BIT_FIELD_REF
        || TREE_CODE (expr) == IMAGPART_EXPR
        || TREE_CODE (expr) == REALPART_EXPR)
*************** sra_modify_assign (gimple *stmt, gimple_
*** 2652,2657 ****
--- 2661,2669 ----
    if (gimple_has_volatile_ops (*stmt)
        || contains_view_convert_expr_p (rhs)
        || contains_view_convert_expr_p (lhs)
+       || ((TREE_CODE (rhs) == PARM_DECL
+ 	   || TREE_CODE (rhs) == VAR_DECL)
+ 	  && DECL_HAS_VALUE_EXPR_P (rhs))
        || (access_has_children_p (racc)
  	  && !ref_expr_for_all_replacements_p (racc, lhs, racc->offset))
        || (access_has_children_p (lacc)


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