On Fri, 27 Jan 2012, Richard Guenther wrote:

> 
> Quite obvious (just generates dead code) and quite annoys reading
> SRA dumps.
> 
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

This regresses gcc.dg/tree-ssa/ipa-split-5.c, ipa-split is confused
about clobbers on paths where the variable is unused.  The following
alternative patch makes SRA remove fully scalarized variables (but
it still won't remove such dead clobbers if there are no other
uses at the time of SRA).

Richard.

2012-01-27  Richard Guenther  <rguent...@suse.de>

        * tree-sra.c (sra_modify_assign): Do not transform clobbers.

Index: gcc/tree-sra.c
===================================================================
*** gcc/tree-sra.c      (revision 183616)
--- gcc/tree-sra.c      (working copy)
*************** sra_modify_constructor_assign (gimple *s
*** 2817,2822 ****
--- 2817,2836 ----
    if (!acc)
      return SRA_AM_NONE;
  
+   if (gimple_clobber_p (*stmt))
+     {
+       /* Remove clobbers of fully scalarized variables, otherwise
+        do nothing.  */
+       if (acc->grp_covered)
+       {
+         unlink_stmt_vdef (*stmt);
+         gsi_remove (gsi, true);
+         return SRA_AM_REMOVED;
+       }
+       else
+       return SRA_AM_NONE;
+     }
+ 
    loc = gimple_location (*stmt);
    if (VEC_length (constructor_elt,
                  CONSTRUCTOR_ELTS (gimple_assign_rhs1 (*stmt))) > 0)

Reply via email to