Patchwork [fortran,4/11] Inline transpose part 1

login
register
mail settings
Submitter Mikael Morin
Date Sept. 4, 2010, 2:24 p.m.
Message ID <4C825683.80801@sfr.fr>
Download mbox | patch
Permalink /patch/63783/
State New
Headers show

Comments

Mikael Morin - Sept. 4, 2010, 2:24 p.m.
The innermost stride of a full array is not necessarily stride[0] if we 
are accessing it transposed.
OK for trunk?
2010-09-03  Mikael Morin  <mikael@gcc.gnu.org>

	* trans-array.c (gfc_trans_preloop_setup): Unconditionally use the
	dim array to get the stride in the innermost loop.

Patch

diff --git a/trans-array.c b/trans-array.c
index 5086641..d4a0542 100644
--- a/trans-array.c
+++ b/trans-array.c
@@ -2733,12 +2733,13 @@  gfc_trans_preloop_setup (gfc_loopinfo * loop, int dim, int flag,
 					      info->offset, index);
 		  info->offset = gfc_evaluate_now (info->offset, pblock);
 		}
-
-	      i = loop->order[0];
-	      stride = gfc_conv_array_stride (info->descriptor, info->dim[i]);
 	    }
-	  else
-	    stride = gfc_conv_array_stride (info->descriptor, 0);
+
+	  i = loop->order[0];
+	  /* For the time being, the innermost loop is unconditionally on
+	     the first dimension of the scalarization loop.  */
+	  gcc_assert (i == 0);
+	  stride = gfc_conv_array_stride (info->descriptor, info->dim[i]);
 
 	  /* Calculate the stride of the innermost loop.  Hopefully this will
              allow the backend optimizers to do their stuff more effectively.