This is the mail archive of the gcc-bugs@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]

[Bug tree-optimization/63530] GCC generates incorrect aligned store on ARM after the loop is unrolled.


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63530

--- Comment #3 from Carrot <carrot at google dot com> ---
It turns out that when function vect_create_addr_base_for_vector_ref create a
new pointer, it doesn't set the correct alignment of pointer value, so the
default alignment of the point_to type is used. We should use the alignment
information from DR_MISALIGNMENT (dr).

I'm testing following patch

Index: tree-vect-data-refs.c
===================================================================
--- tree-vect-data-refs.c    (revision 216341)
+++ tree-vect-data-refs.c    (working copy)
@@ -3957,8 +3957,12 @@
       && TREE_CODE (addr_base) == SSA_NAME)
     {
       duplicate_ssa_name_ptr_info (addr_base, DR_PTR_INFO (dr));
-      if (offset)
+      unsigned int align = TYPE_ALIGN_UNIT (STMT_VINFO_VECTYPE (stmt_info));
+      unsigned misalign = DR_MISALIGNMENT (dr);
+      if (offset || (misalign == -1))
     mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (addr_base));
+      else if (misalign)
+        set_ptr_info_alignment (SSA_NAME_PTR_INFO (addr_base), align,
misalign);
     }

   if (dump_enabled_p ())


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