[gcc r12-3839] tree-optimization/102448 - clear copied alignment info from vect

Richard Biener rguenth@gcc.gnu.org
Thu Sep 23 09:17:52 GMT 2021


https://gcc.gnu.org/g:c0cc62b32d95caca25a8854e0d2b6f11f5674d30

commit r12-3839-gc0cc62b32d95caca25a8854e0d2b6f11f5674d30
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Sep 23 10:27:01 2021 +0200

    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:
---
 gcc/tree-vect-data-refs.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

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);


More information about the Gcc-cvs mailing list