This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/55213] vectorizer ignores __restrict__


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]