public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/60012] New: Vectorizer generates unnecessary loop versioning for alias
@ 2014-01-31 17:18 bmei at broadcom dot com
  2014-02-03 14:44 ` [Bug tree-optimization/60012] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: bmei at broadcom dot com @ 2014-01-31 17:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 60012
           Summary: Vectorizer generates unnecessary loop versioning for
                    alias
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bmei at broadcom dot com

typedef struct
{
   short real;
   short imag;
} complex16_t;

void
libvector_AccSquareNorm_ref (unsigned long long  *acc,
                             const complex16_t *x, unsigned len)
{
    for (unsigned i = 0; i < len; i++)
    {
        acc[i] +=
            ((unsigned long long)((int)x[i].real * x[i].real)) +
            ((unsigned long long)((int)x[i].imag * x[i].imag));
    }
}

Compiler the code with 
~/scratch/install-x86/bin/gcc tst.c -O2 -S -ftree-vectorize
-fdump-tree-vect-details -std=c99

GCC generates unnecessary loop versioning because it cannot disambiguate mem
accesses. 

tst.c:12:5: note: versioning for alias required: can't determine dependence
between *_8 and _12->real
tst.c:12:5: note: mark for run-time aliasing test between *_8 and _12->real

This should be handled by TBAA info as acc & x clearly point to different data
types. But unfortunately, TBAA doesn't handle Anti- & Output- dependencies.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-02-04  9:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-31 17:18 [Bug tree-optimization/60012] New: Vectorizer generates unnecessary loop versioning for alias bmei at broadcom dot com
2014-02-03 14:44 ` [Bug tree-optimization/60012] " rguenth at gcc dot gnu.org
2014-02-04  9:35 ` rguenth at gcc dot gnu.org
2014-02-04  9:35 ` 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).