tree-optimization/102448 - clear copied alignment info from vect
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.
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.
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index a57700f..bdff6ea 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -4629,12 +4629,15 @@
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 @@
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);