This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix vector allignment with -fsection-anchors


The increase_alignment pass currently fails to handle nested arrays
(e.g. static float foo[8][8];). This results in poor code with
-ftree-vectorize -fsection-anchors.

Patch below fixes this by stripping all the ARRAY_TYPEs to get the element 
type.

Tested on arm-none-eabi.

Ok?

Paul

2009-07-20  Paul Brook <paul@codesourcery.com>

	gcc/
	tree-vectorizer.c (increase_alignment): Handle nested arrays.

Index: gcc/tree-vectorizer.c
===================================================================
--- gcc/tree-vectorizer.c	(revision 255853)
+++ gcc/tree-vectorizer.c	(working copy)
@@ -2868,11 +2868,15 @@ increase_alignment (void)
        vnode = vnode->next_needed)
     {
       tree vectype, decl = vnode->decl;
+      tree t;
       unsigned int alignment;
 
-      if (TREE_CODE (TREE_TYPE (decl)) != ARRAY_TYPE)
+      t = TREE_TYPE(decl);
+      if (TREE_CODE (t) != ARRAY_TYPE)
 	continue;
-      vectype = get_vectype_for_scalar_type (TREE_TYPE (TREE_TYPE (decl)));
+      while (TREE_CODE (t) == ARRAY_TYPE)
+	t = TREE_TYPE (t);
+      vectype = get_vectype_for_scalar_type (t);
       if (!vectype)
 	continue;
       alignment = TYPE_ALIGN (vectype);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]