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.