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.
Mine.
Fixed for 4.9.
Author: rguenth Date: Tue Feb 4 09:34:58 2014 New Revision: 207455 URL: http://gcc.gnu.org/viewcvs?rev=207455&root=gcc&view=rev Log: 2014-02-04 Richard Biener <rguenther@suse.de> PR tree-optimization/60012 * tree-vect-data-refs.c (vect_analyze_data_ref_dependence): Apply TBAA disambiguation to all DDRs. * gcc.dg/vect/pr60012.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/vect/pr60012.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-vect-data-refs.c