This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/42652] vectorizer created unaligned vector insns
- From: "law at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 11 Jan 2010 17:14:41 -0000
- Subject: [Bug tree-optimization/42652] vectorizer created unaligned vector insns
- References: <bug-42652-391@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from law at redhat dot com 2010-01-11 17:14 -------
Subject: Re: vectorizer created unaligned vector
insns
On 01/10/10 01:22, irar at il dot ibm dot com wrote:
> ------- Comment #5 from irar at il dot ibm dot com 2010-01-10 08:22 -------
> In vector_alignment_reachable_p() we check if an access is packed using
> contains_packed_reference(). For packed accesses we return false, meaning
> alignment is unreachable and peeling cannot be used.
>
> In the attached testcase contains_packed_reference() returns false for
> palette_5.
>
Right. If you look more closely at the way the code works, there's no
way contains_packed_reference is ever going to return true. It simply
isn't passed the right information. It'd need to be looking at the base
address's type (not the base object). Furthermore,
contains_packed_reference simply isn't designed to dive into types. It
primarily works on exprs and only references the underlying type when it
encounters a COMPONENT_REF.
As Richard apparently pointed out in the past, this code is not
conservatively correct -- if it can't prove the item is properly
aligned, then a runtime check is required.
So while I think we might be able to fix this specific instance by
improving the code around the call to contains_packed_reference, I think
we have a bigger problem as it's fairly trivial to change the test so
that the addresses of interest are parameters and alignment info is
effectively unknown.
Jeff
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42652