https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80198

--- Comment #21 from rguenther at suse dot de <rguenther at suse dot de> ---
On Wed, 27 Jan 2021, rsandifo at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80198
> 
> --- Comment #20 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot 
> gnu.org> ---
> (In reply to Richard Biener from comment #19)
> > So I think when you consider
> > 
> > void __attribute__((noinline)) fun(int * a, int * b, int c)
> > {
> >   int i;
> >   for (i=0; i < 256; i++) {
> >      a[i] = b[i] | c;
> >   }
> > }
> > 
> > we can improve the versioning condition to allow a dependence distance
> > of zero.
> This one was fixed by r10-4803.  E.g. for aarch64 we now have:
> 
>         add     x3, x1, 4
>         sub     x3, x0, x3
>         cmp     x3, 8
>         bls     .L5

Ah, yeah - I failed to decipher the generated check:

  _7 = b_12 + 4;
  _22 = a_10 - _7;
  _23 = (sizetype) _22;
  if (_23 > 8)

the difference is -4U and thus > 8 when a == b.

> > Likewise with
> > 
> > void __attribute__((noipa)) generic(int * a, int * b, int c)
> > {
> >   int i;
> >   a = __builtin_assume_aligned (a, 16);
> >   b = __builtin_assume_aligned (b, 16);
> >   for (i=0; i < 256; i++) {
> >       a[i] = b[i] | c;
> >   }
> > }
> > 
> > we fail to realize no versioning check is required - the distance is
> > either zero or a multiple of 16.
> > 
> > Richard - ISTR you added some alignment considerations to the alias
> > versioning code, but it doesn't seem to help?
> I don't remember adding anything for that, but yeah, I agree it looks
> like we need it.

Reply via email to