This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/55213] vectorizer ignores __restrict__
- From: "josh.m.conner at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 20 Nov 2012 18:05:26 +0000
- Subject: [Bug tree-optimization/55213] vectorizer ignores __restrict__
- Auto-submitted: auto-generated
- References: <bug-55213-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55213
Joshua Conner <josh.m.conner at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |josh.m.conner at gmail dot
| |com
--- Comment #3 from Joshua Conner <josh.m.conner at gmail dot com> 2012-11-20 18:05:26 UTC ---
I'm running into a similar problem in code like this:
void
inner (float * restrict x, float * restrict y, int n)
{
int i;
for (i = 0; i < n; i++)
x[i] *= y[i];
}
void
outer (float *arr, int offset, int bytes)
{
inner (&arr[0], &arr[offset], bytes);
}
In the out-of-line instance of inner(), no alias detection code is generated
(correctly, since the pointers are restricted).
When inner() is inlined into outer(), however, alias detection code is
unnecessarily generated. This alone isn't a terrible penalty except that the
generation of a versioned loop to handle aliasing prevents us from performing
loop peeling for alignment, and so we end up with a vectorized unaligned loop
with poor performance.
Note that the place where I'm actually running into the problem is in fortran,
where pointer arguments are implicitly non-aliasing.