This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/63530] GCC generates incorrect aligned store on ARM after the loop is unrolled.
- From: "carrot at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 17 Oct 2014 00:46:53 +0000
- Subject: [Bug tree-optimization/63530] GCC generates incorrect aligned store on ARM after the loop is unrolled.
- Auto-submitted: auto-generated
- References: <bug-63530-4 at http dot gcc dot gnu dot org/bugzilla/>
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 ())