public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/42652]  New: vectorizer created unaligned vector insns
@ 2010-01-07 17:32 law at redhat dot com
  2010-01-07 17:33 ` [Bug tree-optimization/42652] " law at redhat dot com
                   ` (17 more replies)
  0 siblings, 18 replies; 20+ messages in thread
From: law at redhat dot com @ 2010-01-07 17:32 UTC (permalink / raw)
  To: gcc-bugs

The vectorizer doesn't appear to handle packed structures correctly and
ultimately generates a vector store to an unaligned address which causes a
segfault.

This was originally reported against a 4.4 variant, but investigation shows the
bug is merely latent on the head of the trunk and can be exposed by reverting
this change:

2009-03-29  Richard Guenther  <rguenther@suse.de>

        * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Properly
        propagate addresses of array references.

[ The 2009-03-29 patch changes the end condition of the loop which ultimately
confuses the vectorizer into being unable to determine the number of iterations
in the loop.  That's clearly a weakness in the vectorizer as the loop bounds
are easily shown to be compile-time constants. ]

Compile the attached testcase with -O3 and search the resulting assembly for
these two key insns:

        leaq    2(%rax,%rdi,4), %rdi

This computes the base address for palette->ents which is at offset 2 in the
Palette structure (which is packed).  This insn appears in the vectorized loop
pre-header.  It's later used by:

        movdqa  %xmm0, (%rdi,%rsi)

The faulting vector insn.


Note carefully this isn't a case where peeling iterations can be used to
generate suitable alignment -- the packed nature of the structure results in
all the elt members being unaligned.  

ISTM that vector_alignment_reachable_p is the place to fix this, but I'm not
very familiar with the vectorizer and thus may be off base.


-- 
           Summary: vectorizer created unaligned vector insns
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: law at redhat dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42652


^ permalink raw reply	[flat|nested] 20+ messages in thread
[parent not found: <bug-42652-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2012-07-19 11:38 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-07 17:32 [Bug tree-optimization/42652] New: vectorizer created unaligned vector insns law at redhat dot com
2010-01-07 17:33 ` [Bug tree-optimization/42652] " law at redhat dot com
2010-01-08 11:59 ` rguenth at gcc dot gnu dot org
2010-01-08 16:45 ` law at redhat dot com
2010-01-08 17:25 ` rguenth at gcc dot gnu dot org
2010-01-10  8:23 ` irar at il dot ibm dot com
2010-01-11 17:14 ` law at redhat dot com
2010-01-11 17:16 ` law at redhat dot com
2010-01-12  8:08 ` irar at il dot ibm dot com
2010-01-12 15:19 ` law at redhat dot com
2010-01-13  9:36 ` irar at il dot ibm dot com
2010-01-14 17:30 ` law at redhat dot com
2010-01-14 17:35 ` hjl dot tools at gmail dot com
2010-01-18 12:17 ` irar at il dot ibm dot com
2010-02-09 23:04 ` law at redhat dot com
2010-02-09 23:12 ` rguenth at gcc dot gnu dot org
2010-02-09 23:49 ` law at redhat dot com
2010-02-22  9:01 ` irar at il dot ibm dot com
2010-02-22 10:27 ` rguenth at gcc dot gnu dot org
     [not found] <bug-42652-4@http.gcc.gnu.org/bugzilla/>
2012-07-19 11:38 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).