<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
>what specifically you would like alias analysis to do?<br>
<br>
Quite honestly, I don't know what interface is convenient for
optimizer. I once implemented a flow-sensitive alias-analysis as a
hobby project, <br>
which was able to disambiguate the subscripted variables like a[i]
and a[i-1]. Unfortunately, the interface is pretty messy, that <br>
is why I solicit your insight on this issue. <br>
<br>
The problem is: in what situations, Alias(a[i], a[i-1]) is desirable
to return "alias", and in what situations, <br>
it is desirable to return "no alias". <br>
<br>
Example 1:<br>
===========<br>
<br>
for (i = 0; i < N; i++) {<br>
a[i] = ... /* s1 */<br>
sum += a[i-1];<br>
}<br>
<br>
In DCE, Alias(a[i], a[i-1]) is desirable to return "alias". S1
would otherwise be mistakenly deleted. <br>
<br>
Example 2:<br>
=========<br>
In following contrived example, Alias(a[i], a[i-1]) is desirable to
return "no alias" in order to enable the propagation between S1 and
S3.<br>
<br>
for (i ...) { <br>
a[i] = /* S1 */<br>
a[i-1] = /* S2 */<br>
= a[i] /* S3*/<br>
}<br>
<br>
As you can see from the above two examples, both answers ("alias"
and "not alias") are correct, but in different context. <br>
<br>
Is passing both mem access to Alias() sufficient, or should we also
need to pass <br>
1) the common loop that tightly enclose two memory access, and<br>
2) boolean value indicate if the optimization is across loop or
not.<br>
<br>
We likely should, but it the the interface clunky to use. What is
your insight into this problem?<br>
<br>
Thanks<br>
Shuxin<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 11/9/12 4:44 PM, Dan Gohman wrote:<br>
</div>
<blockquote
cite="mid:CAF4K+2hAWjiWNE8DexBOGk7NOHLu2uWVzmJOcPobdzLC8E2+bQ@mail.gmail.com"
type="cite">Hello,
<div><br>
</div>
<div>I'm afraid I don't understand your question. Could you
restate your example and your question, and say what
specifically you would like alias analysis to do?</div>
<div><br>
</div>
<div>Dan<br>
<br>
<div class="gmail_quote">
On Fri, Nov 9, 2012 at 9:31 AM, Shuxin Yang <span dir="ltr"><<a
moz-do-not-send="true" href="mailto:shuxin.llvm@gmail.com"
target="_blank">shuxin.llvm@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Sorry the 1st example I gave it bit lame, it is changed to
following:<br>
<br>
// a[] is local array, no addr taken. die right after the
loop
<div><br>
for (i = 0; i < N; i++) {<br>
</div>
a[i] = ... /* s1 */<br>
sum += a[i-1];<br>
}<br>
<br>
S1 could be easily deleted if alias analyizer say a[i] and
a[i-1].
<div>
<div><br>
<br>
<br>
On 11/8/12 6:07 PM, Shuxin Yang wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
In today meeting, Dan gave a very impressive talk
about alias analysis.<br>
I had a question about the example in his slide,
something like:<br>
<br>
for (i = 0; i < N; i++) a[i] = a[i-1] + 1;<br>
<br>
For the sake of convenience, let A1, A2 be a[i] and
a[i-1] respectively.<br>
In Dan's design, Alias(A1, A2) would give "no alias",
and in order to<br>
prevent A2 from being mistakenly moved out of loop,
the optimizer<br>
needs to query dependence test as well.<br>
<br>
The problems is how optimizer combine the results
from alias analysis<br>
and dependence test?<br>
<br>
If I change the code little bit, into following,
then combining the<br>
querying dependence testing would prevent hosting *q.<br>
<br>
// points-to(p) = { a, b }<br>
// points-to(q) = { c, d }<br>
for (i = 0; i < N; i++) *p += *q + 1;<br>
<br>
Thanks<br>
Shuxin<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
</blockquote>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a moz-do-not-send="true"
href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>
<a moz-do-not-send="true"
href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a moz-do-not-send="true"
href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev"
target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>