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

Re: [PATCH PR63530] Fix the pointer alignment in vectorization

On Fri, Oct 17, 2014 at 7:58 PM, Carrot Wei <> wrote:
> Hi
> In current vectorization pass, when a new vector pointer is created,
> its alignment is not set correctly. We should use DR_MISALIGNMENT (dr)
> since only this alignment is adjusted when loop peeling or multi
> version is occurred.
> This patch passed following tests:
> x86_64 bootstrap.
> x86_64 regression test.
> armv7 regression test.
> OK for trunk and 4.9 branch?

I miss a testcase.  I also miss a comment before this code explaining
why DR_MISALIGNMENT if not -1 is valid and why it is not valid if
'offset' is supplied (what about 'byte_offset' btw?).  Also if peeling
for alignment aligned this ref (misalign == 0) you don't set the alignment.

Thus you may fix a bug (not sure without a testcase) but the new code
certainly doesn't look 100% correct.

That said, I would have expected that we can unconditionally do

 set_ptr_info_alignment (..., align, misalign)

if misalign is != -1 and if we adjust misalign by offset * step + byte_offset
(usually both are constants).

Also we can still trust the alignment copied from addr_base modulo
vector element size even if DR_MISALIGN is -1.  This may matter
for targets that require element-alignment for vector accesses.


> thanks
> Guozhi Wei
> 2014-10-17  Guozhi Wei  <>
>         PR tree-optimization/63530
>         tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Set
>         pointer alignment according to DR_MISALIGNMENT.

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