<div dir="ltr"><div><div><div>Hello all,<br><br></div>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.<br><br></div>As it says <a href="http://llvm.org/docs/AliasAnalysis.html">on this web page</a>,<br>
<br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">The <tt class=""><span class="">MayAlias</span></tt> response is used whenever the two pointers might refer to the
same object.
<p>The <tt class=""><span class="">PartialAlias</span></tt> response is used when the two memory objects are known to
be overlapping in some way, but do not start at the same address.</p>
<p>The <tt class=""><span class="">MustAlias</span></tt> response may only be returned if the two memory objects are
guaranteed to always start at exactly the same location. A <tt class=""><span class="">MustAlias</span></tt>
response implies that the pointers compare equal.</p></blockquote>Reading this, it seems the "MustAlias" result is exceptionally strong.<br><br></div><div>Consider this loop<br><br><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">
<div><div>std::vector<int> A(100); <br></div><div>int* x,y;</div></div></blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"><div><div>
<div><div></div>for(int i=0; i<100; i++) {<br></div> x=&A[i]; <br></div> y=&A[i];<br></div> *y=*x; <br>}<br></blockquote><div> <br></div><div>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<br>
<br></div><div>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?<br><br></div><div>
Thank you for clearing this up for me.<br>
<br>Jeremy<br></div></div><div><a href="http://llvm.org/docs/AliasAnalysis.html"></a></div></div>