This fixes the IPA-SRA sub-optimality discovered in PR51895.  We
should avoid decomposing anything into BLKmode components if the
original param wasn't already BLKmode.

Bootstrap and regtest pending on x86_64-unknown-linux-gnu.

Richard.

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

        PR tree-optimization/51895
        * tree-sra.c (decide_one_param_reduction): Avoid sub-optimal
        parameter decomposition into BLKmode components.

Index: gcc/tree-sra.c
===================================================================
--- gcc/tree-sra.c      (revision 183421)
+++ gcc/tree-sra.c      (working copy)
@@ -3914,6 +3914,13 @@ decide_one_param_reduction (struct acces
       if (by_ref && repr->non_addressable)
        return 0;
 
+      /* Do not decompose a non-BLKmode param in a way that would
+         create BLKmode params.  Especially for by-reference passing
+        (thus, pointer-type param) this is hardly worthwhile.  */
+      if (DECL_MODE (parm) != BLKmode
+         && TYPE_MODE (repr->type) == BLKmode)
+       return 0;
+
       if (!by_ref || (!repr->grp_maybe_modified
                      && !repr->grp_not_necessarilly_dereferenced))
        total_size += repr->size;

Reply via email to