[PATCH] Scoped NoAlias Metadata

Hal Finkel hfinkel at anl.gov
Wed Jul 23 00:04:03 PDT 2014


----- Original Message -----
> From: "Tobias Grosser" <tobias at grosser.es>
> To: reviews+D2194+public+a9f2c71a9ad3b374 at reviews.llvm.org, hfinkel at anl.gov, dan433584 at gmail.com, atrick at apple.com,
> chandlerc at gmail.com
> Cc: llvm-commits at cs.uiuc.edu
> Sent: Wednesday, July 23, 2014 2:01:25 AM
> Subject: Re: [PATCH] Scoped NoAlias Metadata
> 
> On 20/07/2014 05:47, hfinkel at anl.gov wrote:
> > +Each type of metadata specifies a list of scopes, and when
> > evaluating an
> > +aliasing query, if one of the instructions has a scope in its
> > ``alias.scope``
> > +list that is identical to a scope in the other instruction's
> > ``noalias`` list,
> > +or is a descendant (in the scope hierarchy) of a scope in the
> > other
> > +instruction's ``noalias`` list , then the two memory accesses are
> > assumed not
> > +to alias.
> 
> Hi Hal,
> 
> one point that did not get immediately clear from the documentation
> is
> what happens in such a case.
> 
> void func(float A[restrict], float B[restrict],
>            int i, int j, int k, int l) {
>     A[i] = A[j] = B[k] = B[l];
> }
> 
> I assume all four instructions will be in the same alias.scope,
> right?

No, each restrict pointer will essentially get its own scope. In this way, you can precisely specify what may alias with what.

 -Hal

> 
> Now, is there a way to define that the values that A[i] and A[j] may
> possibly alias, that B[k] and B[l] may possibly alias, but no A[?],
> B[?]
> pair will alias. Basically, I would like to represent the same
> information as was available in the original C program.
> 
> If I add noalias metadata to the loads then A[i] and A[j] would be
> assumed to not alias either. Is this right?
> 
> Cheers,
> Tobias
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list