diff mbox series

tree-optimization/102448 - clear copied alignment info from vect

Message ID 822156pq-4o96-8qrs-20o0-oq3n542n9rp1@fhfr.qr
State New
Headers show
Series tree-optimization/102448 - clear copied alignment info from vect | expand

Commit Message

Richard Biener Sept. 23, 2021, 9:17 a.m. UTC
This fixes the previous change which removed setting alignment info
from the vectorizers idea of how a pointer is being used but left
in place the copied info from DR_PTR_INFO without realizing that this
is in fact _not_ the alignment of the access but the alignment of
a base pointer contained in it.

The following makes sure to not use that info.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

2021-09-23  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/102448
	* tree-vect-data-refs.c (vect_duplicate_ssa_name_ptr_info):
	Clear alignment info copied from DR_PTR_INFO.
---
 gcc/tree-vect-data-refs.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index a57700f2c1b..bdff6ea54ac 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -4629,12 +4629,15 @@  vect_get_new_ssa_name (tree type, enum vect_var_kind var_kind, const char *name)
   return new_vect_var;
 }
 
-/* Duplicate ptr info and set alignment/misaligment on NAME from DR_INFO.  */
+/* Duplicate points-to info on NAME from DR_INFO.  */
 
 static void
 vect_duplicate_ssa_name_ptr_info (tree name, dr_vec_info *dr_info)
 {
   duplicate_ssa_name_ptr_info (name, DR_PTR_INFO (dr_info->dr));
+  /* DR_PTR_INFO is for a base SSA name, not including constant or
+     variable offsets in the ref so its alignment info does not apply.  */
+  mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name));
 }
 
 /* Function vect_create_addr_base_for_vector_ref.
@@ -4738,11 +4741,7 @@  vect_create_addr_base_for_vector_ref (vec_info *vinfo, stmt_vec_info stmt_info,
   if (DR_PTR_INFO (dr)
       && TREE_CODE (addr_base) == SSA_NAME
       && !SSA_NAME_PTR_INFO (addr_base))
-    {
-      vect_duplicate_ssa_name_ptr_info (addr_base, dr_info);
-      if (offset || byte_offset)
-	mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (addr_base));
-    }
+    vect_duplicate_ssa_name_ptr_info (addr_base, dr_info);
 
   if (dump_enabled_p ())
     dump_printf_loc (MSG_NOTE, vect_location, "created %T\n", addr_base);