<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 17, 2017 at 12:07 AM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF"><span class="gmail-">
<p><br>
</p>
<div class="gmail-m_607283191610384526moz-cite-prefix">On 11/17/2017 02:01 AM, Hongbin Zheng
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Do you mean a and b are noalias if:
<div><br>
</div>
<div><span style="font-size:12.8px">static int foo(int *a, int
*b) {</span><br style="font-size:12.8px">
<span style="font-size:12.8px"> return a[0] + b[0];</span><br style="font-size:12.8px">
<span style="font-size:12.8px">}</span><br style="font-size:12.8px">
<br style="font-size:12.8px">
<span style="font-size:12.8px">int bar(int *x) {</span><br style="font-size:12.8px">
<span style="font-size:12.8px"> return foo(x+1, x);</span><br style="font-size:12.8px">
<span style="font-size:12.8px">}</span><br>
</div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">?</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">To me, because
"AA.alias((x+1, <wbr>MemoryLocation::UnknownSize), </span><span style="font-size:12.8px"><wbr>(x, MemoryLocation::<wbr>UnknownSize))</span><span style="font-size:12.8px"> != NoAlias", so a and b are not
noalias.</span></div>
</div>
</blockquote>
<br></span>
Remember that MemoryLocation::UnknownSize is unknown, but positive.
So you need to check both "AA.alias((x+1,
MemoryLocation::UnknownSize), (x, MemoryLocation::UnknownSize)) ==
NoAlias" and "AA.alias((x, MemoryLocation::UnknownSize), (x+1,
MemoryLocation::UnknownSize)) == NoAlias" to partition by underlying
object. One of these should be false.</div></blockquote><div><br></div><div>Thanks a lot for the explanation.</div><div>Do you mean AA.alias(X,Y) may not always return the same result as AA.alias(Y,X)? (otherwise why we need to do both of them)</div><div>[1] Didn't mention this detail.</div><div><br></div><div>Thanks again</div><div>Hongbin</div><div><br></div><div><br></div><div>[1] <a href="https://llvm.org/docs/AliasAnalysis.html#the-alias-method">https://llvm.org/docs/AliasAnalysis.html#the-alias-method</a></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF"><span class="gmail-HOEnZb"><font color="#888888"><br>
<br>
-Hal</font></span><div><div class="gmail-h5"><br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div><span style="font-size:12.8px">Maybe my version is too
conservative.</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
<div><span style="font-size:12.8px">Thanks</span></div>
<div><span style="font-size:12.8px">Hongbin</span></div>
<div><span style="font-size:12.8px"><br>
</span></div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Nov 16, 2017 at 11:55 PM, Hal
Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF"><span>
<p><br>
</p>
<div class="gmail-m_607283191610384526m_4344742898765767199moz-cite-prefix">On
11/17/2017 01:49 AM, Hongbin Zheng wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">Could you elaborate "<span style="font-size:12.8px">Note that, without
further analysis of the uses of the
potentially-noalias pointers, you can do this only
...</span>"?
<div>Why the uses, instead of the def, of pointer
matter?</div>
</div>
</blockquote>
<br>
</span> Both matter.<br>
<br>
static int foo(int *a, int *b) {<br>
return a[0] + b[1];<br>
}<br>
<br>
int bar(int *x) {<br>
return foo(x+1, x);<br>
}<br>
<br>
You can't mark a and b as noalias here, even though
NoAlias(x+1, x) == true. This is why I was saying that,
unless the pointers come from distinct, identified
underlying objects, you need to look at the uses of the
pointers too.<span class="gmail-m_607283191610384526HOEnZb"><font color="#888888"><br>
<br>
-Hal<br>
</font></span><br>
P.S. As discussed in D4609, we probably want to try adding
CGSCC AA wrappers, to look back through function
arguments, instead of using attribute propagation.
<div>
<div class="gmail-m_607283191610384526h5"><br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
<div>Thanks</div>
<div>Hongbin</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Nov 16, 2017 at
11:21 PM, Hal Finkel via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi, Alexandre,<br>
<br>
We don't have anything currently which does
this. Note that, without further analysis of
the uses of the potentially-noalias pointers,
you can do this only for arguments with
distinct (and identified) underlying objects
(i.e., you need something a bit stronger than
just "non-aliasing pointers").<br>
<br>
-Hal
<div class="gmail-m_607283191610384526m_4344742898765767199HOEnZb">
<div class="gmail-m_607283191610384526m_4344742898765767199h5"><br>
<br>
On 11/16/2017 10:11 AM, via llvm-dev
wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Is this
what you are looking for?<br>
<br>
<a href="https://reviews.llvm.org/D4609" rel="noreferrer" target="_blank">https://reviews.llvm.org/D4609</a><br>
<br>
Best,<br>
<br>
Haicheng Wu<br>
<br>
On 2017-11-14 20:34, Alexandre Isoard
via llvm-dev wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Hello,<br>
<br>
Do we have a pass that propagate the
noalias annotation down to the<br>
callee when:<br>
- it is static<br>
- it is always called with non
aliasing pointers<br>
?<br>
<br>
Or maybe that is incorrect?<br>
<br>
-- <br>
<br>
ALEXANDRE ISOARD<br>
</blockquote>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</blockquote>
<br>
</div>
</div>
<span class="gmail-m_607283191610384526m_4344742898765767199HOEnZb"><font color="#888888"> -- <br>
Hal Finkel<br>
Lead, Compiler Technology and Programming
Languages<br>
Leadership Computing Facility<br>
Argonne National Laboratory</font></span>
<div class="gmail-m_607283191610384526m_4344742898765767199HOEnZb">
<div class="gmail-m_607283191610384526m_4344742898765767199h5"><br>
<br>
______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<pre class="gmail-m_607283191610384526m_4344742898765767199moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<pre class="gmail-m_607283191610384526moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</div></div></div>
</blockquote></div><br></div></div>