public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR49536
@ 2011-06-27 11:32 Richard Guenther
  0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2011-06-27 11:32 UTC (permalink / raw)
  To: gcc-patches


This fixes PR49536 by making sure to use only non-aggregate component
types when building vector types.  If we try to vectorize a load
of an aggregate with SImode use a vector with a component type
corresponding with that mode, not the aggregate type.  This way
we'll still vectorize memory copy loops while failing on the
scalar component extracts anyway.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

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.

Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c	(revision 175424)
+++ gcc/tree-vect-stmts.c	(working copy)
@@ -5350,6 +5350,15 @@ get_vectype_for_scalar_type_and_size (tr
       && 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)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-27 10:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-27 11:32 [PATCH] Fix PR49536 Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).