Hi, In today meeting, Dan gave a very impressive talk about alias analysis. I had a question about the example in his slide, something like: for (i = 0; i < N; i++) a[i] = a[i-1] + 1; For the sake of convenience, let A1, A2 be a[i] and a[i-1] respectively. In Dan's design, Alias(A1, A2) would give "no alias", and in order to prevent A2 from being mistakenly moved out of loop, the optimizer needs to query dependence test as well. The problems is how optimizer combine the results from alias analysis and dependence test? If I change the code little bit, into following, then combining the querying dependence testing would prevent hosting *q. // points-to(p) = { a, b } // points-to(q) = { c, d } for (i = 0; i < N; i++) *p += *q + 1; Thanks Shuxin
Sorry the 1st example I gave it bit lame, it is changed to following: // a[] is local array, no addr taken. die right after the loop for (i = 0; i < N; i++) { a[i] = ... /* s1 */ sum += a[i-1]; } S1 could be easily deleted if alias analyizer say a[i] and a[i-1]. On 11/8/12 6:07 PM, Shuxin Yang wrote:> Hi, > > In today meeting, Dan gave a very impressive talk about alias > analysis. > I had a question about the example in his slide, something like: > > for (i = 0; i < N; i++) a[i] = a[i-1] + 1; > > For the sake of convenience, let A1, A2 be a[i] and a[i-1] respectively. > In Dan's design, Alias(A1, A2) would give "no alias", and in order to > prevent A2 from being mistakenly moved out of loop, the optimizer > needs to query dependence test as well. > > The problems is how optimizer combine the results from alias analysis > and dependence test? > > If I change the code little bit, into following, then combining the > querying dependence testing would prevent hosting *q. > > // points-to(p) = { a, b } > // points-to(q) = { c, d } > for (i = 0; i < N; i++) *p += *q + 1; > > Thanks > Shuxin > > > > > > > > > > > >
Hello, 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? Dan On Fri, Nov 9, 2012 at 9:31 AM, Shuxin Yang <shuxin.llvm at gmail.com> wrote:> Sorry the 1st example I gave it bit lame, it is changed to following: > > // a[] is local array, no addr taken. die right after the loop > > for (i = 0; i < N; i++) { > a[i] = ... /* s1 */ > sum += a[i-1]; > } > > S1 could be easily deleted if alias analyizer say a[i] and a[i-1]. > > > > On 11/8/12 6:07 PM, Shuxin Yang wrote: > >> Hi, >> >> In today meeting, Dan gave a very impressive talk about alias >> analysis. >> I had a question about the example in his slide, something like: >> >> for (i = 0; i < N; i++) a[i] = a[i-1] + 1; >> >> For the sake of convenience, let A1, A2 be a[i] and a[i-1] respectively. >> In Dan's design, Alias(A1, A2) would give "no alias", and in order to >> prevent A2 from being mistakenly moved out of loop, the optimizer >> needs to query dependence test as well. >> >> The problems is how optimizer combine the results from alias analysis >> and dependence test? >> >> If I change the code little bit, into following, then combining the >> querying dependence testing would prevent hosting *q. >> >> // points-to(p) = { a, b } >> // points-to(q) = { c, d } >> for (i = 0; i < N; i++) *p += *q + 1; >> >> Thanks >> Shuxin >> >> >> >> >> >> >> >> >> >> >> >> >> > ______________________________**_________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20121109/a647dc64/attachment.html>