http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57558
Bug ID: 57558
Summary: Issue with number of iterations calculation
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: ysrumyan at gmail dot com
For the following simple test-case extracted from 254.gap (spec2000):
typedef unsigned long ul;
void foo (ul* __restrict x, ul* __restrict y, ul n)
{
ul i;
for (i=1; i<=n; i++, x++, y++)
*x ^= *y;
}
gcc cannot determine number of iterations and failed to vectorize loop:
t1.c:5: note: === get_loop_niters ===Analyzing # of iterations of loop 1
exit condition [2, + , 1] <= n_8(D)
bounds on difference of bases: -1 ... 4294967293
result:
under assumptions n_8(D) != 4294967295
# of iterations n_8(D) + 4294967295, bounded by 4294967294
t1.c:5: note: not vectorized: number of iterations cannot be computed.
Note that if we change for-stmt to
for (i=0; i<n; i++, x++, y++)
it will be vectorized.