re PR middle-end/49536 (latent bug with creation of vector of arrays)
authorRichard Guenther <rguenther@suse.de>
Mon, 27 Jun 2011 10:31:30 +0000 (10:31 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 27 Jun 2011 10:31:30 +0000 (10:31 +0000)
2011-06-27  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/49536
* tree-vect-stmts.c (get_vectype_for_scalar_type_and_size):
For non-scalar inner types use a scalar type according to
the scalar inner mode.

From-SVN: r175475

gcc/ChangeLog
gcc/tree-vect-stmts.c

index 4a8cf00e4f1bc4bba6be5ffeeef29346c8e64d2b..b6e12f14b3a408725505f107acf0d37b287ed75d 100644 (file)
@@ -1,3 +1,10 @@
+2011-06-27  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/49536
+       * tree-vect-stmts.c (get_vectype_for_scalar_type_and_size):
+       For non-scalar inner types use a scalar type according to
+       the scalar inner mode.
+
 2011-06-27  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/49365
index f9b963910816fb08fdd9dbcae163bd6f5085df33..8ac212556622f7ef11a3ecfb0f52cf879905c7f2 100644 (file)
@@ -5350,6 +5350,15 @@ get_vectype_for_scalar_type_and_size (tree scalar_type, unsigned size)
       && GET_MODE_CLASS (inner_mode) != MODE_FLOAT)
     return NULL_TREE;
 
+  /* We shouldn't end up building VECTOR_TYPEs of non-scalar components.
+     When the component mode passes the above test simply use a type
+     corresponding to that mode.  The theory is that any use that
+     would cause problems with this will disable vectorization anyway.  */
+  if (!SCALAR_FLOAT_TYPE_P (scalar_type)
+      && !INTEGRAL_TYPE_P (scalar_type)
+      && !POINTER_TYPE_P (scalar_type))
+    scalar_type = lang_hooks.types.type_for_mode (inner_mode, 1);
+
   /* If no size was supplied use the mode the target prefers.   Otherwise
      lookup a vector mode of the specified size.  */
   if (size == 0)