Patchwork Fix alignment of vectorizer generated pointers

login
register
mail settings
Submitter Richard Guenther
Date Dec. 7, 2010, 4:31 p.m.
Message ID <alpine.LNX.2.00.1012071730080.23074@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/74579/
State New
Headers show

Comments

Richard Guenther - Dec. 7, 2010, 4:31 p.m.
For those pointers the vectorizer doesn't base accesses off we
have to watch out when copying SSA name pointer information as
offsetting them invalidates alignment information.  This was
noticed by Micha when working on some patch.

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

Richard.

2010-12-07  Richard Guenther  <rguenther@suse.de>

	* tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref):
	Reset alignment information.
	(bump_vector_ptr): Likewise.

Patch

Index: gcc/tree-vect-data-refs.c
===================================================================
--- gcc/tree-vect-data-refs.c	(revision 167534)
+++ gcc/tree-vect-data-refs.c	(working copy)
@@ -2918,7 +2918,14 @@  vect_create_addr_base_for_vector_ref (gi
 
   if (DR_PTR_INFO (dr)
       && TREE_CODE (vec_stmt) == SSA_NAME)
-    duplicate_ssa_name_ptr_info (vec_stmt, DR_PTR_INFO (dr));
+    {
+      duplicate_ssa_name_ptr_info (vec_stmt, DR_PTR_INFO (dr));
+      if (offset)
+	{
+	  SSA_NAME_PTR_INFO (vec_stmt)->align = 1;
+	  SSA_NAME_PTR_INFO (vec_stmt)->misalign = 0;
+	}
+    }
 
   if (vect_print_dump_info (REPORT_DETAILS))
     {
@@ -3308,7 +3315,11 @@  bump_vector_ptr (tree dataref_ptr, gimpl
 
   /* Copy the points-to information if it exists. */
   if (DR_PTR_INFO (dr))
-    duplicate_ssa_name_ptr_info (new_dataref_ptr, DR_PTR_INFO (dr));
+    {
+      duplicate_ssa_name_ptr_info (new_dataref_ptr, DR_PTR_INFO (dr));
+      SSA_NAME_PTR_INFO (new_dataref_ptr)->align = 1;
+      SSA_NAME_PTR_INFO (new_dataref_ptr)->misalign = 0;
+    }
 
   if (!ptr_incr)
     return new_dataref_ptr;