Hi Whitney,
The aliasing information conveyed by alias.scope and noalias is static, but each
do provide lists of alias scopes (in different distinct domains). I think that
this is easiest to understand in the context of translating noalias function
parameters into the representation of the metadata.
Let's assume we have a function like this:
void foo(float* noalias p, float *noalias q, float* r, bool b) {
float *t = b ? p : q;
*r = *t;
}
To translate the 'noalias' function parameter attributes into metadata
(which we do when inlining, see AddAliasScopeMetadata in
lib/Transforms/Utils/InlineFunction.cpp). We add one alias scope for each
noalias function parameter, so here we have two scopes: one for p and one for q.
These scopes are used to indicate pointer accesses that derive from those
pointers.
In this example, consider the access *t. This pointer might be derived from p or
from q, and so it gets both scopes in its !alias.scope metadata. Now consider
the access to *r. We know that it does not derive from either p or q, so it gets
both scopes in its !noalias metadata list. Conceptually speaking, the
!alias.scope list is an "or", and the !noalias list is an
"and".
-Hal
----- Original Message -----> From: "Whitney Tsang" <whitneyt at ca.ibm.com>
> To: llvmdev at cs.uiuc.edu
> Sent: Monday, September 22, 2014 10:04:20 AM
> Subject: [LLVMdev] noalias and alias.scope metadata notations
>
>
>
>
> Hi all,
>
> In LLVM language reference I read that one can use noalias and
> alias.scope metadata to provide more detailed information about
> pointer aliasing. However, I am not clear about how the notations
> should be. Am I right that all load instruction should have
> !alias.scope at the end and all store instruction should have
> !noalias at the end? If yes, why? If I understand it correctly,
> aliasing information should be static (i.e. one !alias.scope and
> !noalias should be enough for each variable).
>
> Thanks,
> Whitney
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory