[LLVMdev] Alias Analysis Semantics
Jeremy Salwen
jeremysalwen at gmail.com
Wed Aug 13 13:39:12 PDT 2014
Hello all,
I've read the documentation on alias analysis, and I think I understand it
literally, but I just want to be sure, because it seems a bit strange.
As it says on this web page <http://llvm.org/docs/AliasAnalysis.html>,
The MayAlias response is used whenever the two pointers might refer to the
> same object.
>
> The PartialAlias response is used when the two memory objects are known
> to be overlapping in some way, but do not start at the same address.
>
> The MustAlias response may only be returned if the two memory objects are
> guaranteed to always start at exactly the same location. A MustAlias
> response implies that the pointers compare equal.
>
Reading this, it seems the "MustAlias" result is exceptionally strong.
Consider this loop
std::vector<int> A(100);
> int* x,y;
>
for(int i=0; i<100; i++) {
> x=&A[i];
> y=&A[i];
> *y=*x;
> }
>
Here it seems obvious that the load and store on the last line must "alias"
in some sense, but the load and store in fact have different values between
different iterations of the loop, so if we interpret "always start at
exactly the same location" literally, that would mean "mustalias" is false
Is MustAlias considering only the most recent execution? Or is it only
considering within the same iteration of a loop? Does MustAlias use the
same aliasing model as the other results?
Thank you for clearing this up for me.
Jeremy
<http://llvm.org/docs/AliasAnalysis.html>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140813/f7738ef9/attachment.html>
More information about the llvm-dev
mailing list