<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><br>
</p>
<div class="moz-cite-prefix">On 03/09/2017 01:39 PM, Alexandre
Isoard via llvm-dev wrote:<br>
</div>
<blockquote
cite="mid:CANLM5LdiS5jteEOb+MxWCxC8ZOXz4g5NknYWu-AzfMs_41DshA@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr">Hello fellow LLVM developers,
<div><br>
</div>
<div>I was wondering about the semantic of aliasing.</div>
<div>Here are some examples where I am not sure if the two
stores aliases:</div>
<div><br>
</div>
<div>Example 1:</div>
<div><br>
</div>
<div>for (int i = 2; i < n; ++i) {</div>
<div> store A[i];</div>
<div> store A[i-2];</div>
<div>}</div>
<div><br>
</div>
<div>Example 2:</div>
<div><br>
</div>
<div>for (int i = 2; i < n; ++i)</div>
<div> store A[i];</div>
<div>
<div>for (int i = 2; i < n; ++i)</div>
<div> store A[i-2];</div>
<div><br>
</div>
<div>In the example 1, they do not alias in a single
iteration, but they do alias at some point if n > 4.</div>
</div>
</div>
</blockquote>
<br>
If you ask LLVM's AA whether 'store A[i]' and 'store A[i-2]' alias,
it should say NoAlias. When two memory accesses have addresses that
depend on common SSA values (the PHI node %i in this case), then it
is interpreted as having the same value in both instructions.<br>
<br>
In example 2, you should get a MayAlias result, the PHI in both
loops will be distinct SSA values (even though you've given them the
same name in your example), and we can't prove that the memory
accessed by the first store is disjoint from the memory accessed by
the second.<br>
<br>
In any case, please don't confuse our AA for a loop dependence
analysis. Are you looking for a loop dependence analysis?<br>
<br>
-Hal<br>
<br>
<blockquote
cite="mid:CANLM5LdiS5jteEOb+MxWCxC8ZOXz4g5NknYWu-AzfMs_41DshA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>That is, there is an execution path from one instance of
the store to an instance of the other store such that they
access the same memory cell.</div>
<div><br>
</div>
<div>In example 2 it is easier to see the difference.</div>
<div><br>
</div>
<div>I am somewhat in the fog here.</div>
<div><br>
</div>
<div>Best regard.</div>
<div><br>
</div>
-- <br>
<div class="gmail_signature">
<div dir="ltr"><b>Alexandre Isoard</b><br>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>
<a class="moz-txt-link-freetext" href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</body>
</html>