Patchwork Fix IPA-SRA creating BLKmode sub-params (PR51895)

login
register
mail settings
Submitter Richard Guenther
Date Jan. 23, 2012, 9:52 a.m.
Message ID <alpine.LNX.2.00.1201231051320.4999@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/137327/
State New
Headers show

Comments

Richard Guenther - Jan. 23, 2012, 9:52 a.m.
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  <rguenther@suse.de>

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

Patch

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;