This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH PR63530] Fix the pointer alignment in vectorization
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Carrot Wei <carrot at google dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Cong Hou <congh at google dot com>, Luis Lozano <llozano at google dot com>, Caroline Tice <cmtice at google dot com>
- Date: Mon, 20 Oct 2014 10:19:02 +0200
- Subject: Re: [PATCH PR63530] Fix the pointer alignment in vectorization
- Authentication-results: sourceware.org; auth=none
- References: <CAEe8uEAoCuXuOSNM3SndDn+MY+b5OWEVR121Lu-dg6tKG1Wg5g at mail dot gmail dot com>
On Fri, Oct 17, 2014 at 7:58 PM, Carrot Wei <firstname.lastname@example.org> wrote:
> 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.
> Guozhi Wei
> 2014-10-17 Guozhi Wei <email@example.com>
> PR tree-optimization/63530
> tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Set
> pointer alignment according to DR_MISALIGNMENT.