https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108863
Bug ID: 108863
Summary: Unrolling could use range information
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
Target Milestone: ---
Created attachment 54497
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54497&action=edit
Assembly code generated by test case
Looking a bit more at the code generated for the test code of PR108839.
For the test
$ cat u2.c
void foo(double *const restrict dx, double *dy, double da, long int n)
{
long int m = n % 4;
for (unsigned long i = 0; i < m; i++ )
dy[i] = dy[i] + da * dx[i];
}
a recently-ish trunk gives, with
$ gcc -S -O3 -funroll-all-loops -fno-tree-vectorize u2.c
far too much unrolling for a loop which can only be executed, at
most, four times (see attachment).
The range information about m does not appear to be propagated to
the unroll passes.