<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 15 January 2015 at 13:10, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Yes.<div>I've attached an updated patch that does the following:<br><br></div><div>1. Fixes the partialalias of globals/arguments</div><div>2. Enables partialalias for cases where nothing has been unified to a global/argument</div><div>3. Fixes that select was unifying the condition to the other pieces (the condition does not need to be processed :P). This was causing unnecessary aliasing.</div></div></blockquote><div><br></div><div>Consider this:<br></div><div><br></div><div>void *p = ...;</div><div>uintptr_t i = p;</div><div>uintptr_t j = 0;</div><div>for (int a = 0; a < sizeof(uintptr_t); ++a) {</div><div>  j = i >> (sizeof(uintptr_t) - a - 1) ? 1 : 0;</div><div>  j <<= 1;</div><div>}</div><div>void *q = j;</div><div><br></div><div>alias(p, q) isn't NoAlias. (Okay, it kinda is in C++, but not in the equivalent LLVM IR. Please don't make me rewrite my example in LLVM IR.)</div><div><br></div><div>Nick</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>4. Adds a regression test to must-and-partial<br></div><div>5. Fixes the pass ordering</div><div>6. Does not alias non-pointer arguments to random things :)</div><div>7. Fixes the CFL test cases that break with above.</div><div><br></div><div><br></div><div><br></div></div><div class=""><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 15, 2015 at 11:33 AM, Ana Pazos <span dir="ltr"><<a href="mailto:apazos@codeaurora.org" target="_blank">apazos@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Daniel, don’t we need to fix the order of invoking alias analyses in lib/Transforms/IPO/PassManagerBuilder.cpp as well?<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Your patch fixed the order in lib/CodeGen/Passes.cpp and the delegation code in lib/Analysis/CFLAliasAnalysis.cpp.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks,<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Ana.<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:11pt;font-family:Calibri,sans-serif">From:</span></b><span style="font-size:11pt;font-family:Calibri,sans-serif"> Daniel Berlin [mailto:<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>] <br><b>Sent:</b> Wednesday, January 14, 2015 1:10 PM<br><b>To:</b> Ana Pazos<br><b>Cc:</b> George Burgess IV; Nick Lewycky; Jiangning Liu; LLVM Developers Mailing List</span></p><div><div><br><b>Subject:</b> Re: [LLVMdev] question about enabling cfl-aa and collecting a57 numbers<u></u><u></u></div></div><p></p><div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">Oh, sorry, i didn't rebase it when i changed the fix, you would have had to apply the first on top of the second.<u></u><u></u></p><div><div><p class="MsoNormal">Here is one against HEAD<u></u><u></u></p></div></div></div><div><p class="MsoNormal"><u></u> <u></u></p><div><p class="MsoNormal">On Wed, Jan 14, 2015 at 12:32 PM, Ana Pazos <<a href="mailto:apazos@codeaurora.org" target="_blank">apazos@codeaurora.org</a>> wrote:<u></u><u></u></p><blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in"><div><div><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Daniel, your patch does not apply cleanly. Are you on the tip?</span><u></u><u></u></p><pre style="background:white"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">The code I see there is no line</span><span style="color:black">    if (QueryResult == MayAlias|| QueryResult == PartialAlias)</span><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> to be removed.</span><u></u><u></u></pre><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Thanks,</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">Ana.</span><u></u><u></u></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"> </span><u></u><u></u></p><div><div style="border-style:solid none none;border-top-color:rgb(225,225,225);border-top-width:1pt;padding:3pt 0in 0in"><p class="MsoNormal"><b><span style="font-size:11pt;font-family:Calibri,sans-serif">From:</span></b><span style="font-size:11pt;font-family:Calibri,sans-serif"> George Burgess IV [mailto:<a href="mailto:george.burgess.iv@gmail.com" target="_blank">george.burgess.iv@gmail.com</a>] <br><b>Sent:</b> Wednesday, January 14, 2015 10:31 AM<br><b>To:</b> Daniel Berlin<br><b>Cc:</b> Nick Lewycky; Ana Pazos; Jiangning Liu; LLVM Developers Mailing List<br><b>Subject:</b> Re: [LLVMdev] question about enabling cfl-aa and collecting a57 numbers</span><u></u><u></u></p></div></div><div><div><p class="MsoNormal"> <u></u><u></u></p><div><div><div><p class="MsoNormal">Inline <br><br>- George<u></u><u></u></p><div><p class="MsoNormal" style="margin-bottom:12pt"><br>On Jan 14, 2015, at 10:49 AM, Daniel Berlin <<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>> wrote:<u></u><u></u></p></div><blockquote style="margin-top:5pt;margin-bottom:5pt"><div><div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">On Tue, Jan 13, 2015 at 11:26 PM, Nick Lewycky <<a href="mailto:nlewycky@google.com" target="_blank">nlewycky@google.com</a>> wrote:<u></u><u></u></p><blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><div><div><p class="MsoNormal">On 13 January 2015 at 22:11, Daniel Berlin <<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>> wrote:<u></u><u></u></p><blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><p class="MsoNormal">This is caused by CFLAA returning PartialAlias for a query that BasicAA can prove is NoAlias.<u></u><u></u></p></div></blockquote><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">One of them is wrong. Which one? <u></u><u></u></p></div></div></div></div></blockquote><blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><div><div><div><p class="MsoNormal"> <u></u><u></u></p></div></div></div></div></blockquote><div><p class="MsoNormal">CFL-AA.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Right now it checks whether two things come out to be the same stratified info and have the same index, and if so, returns PartialAlias. This is wrong, because it never knows why two things got unified, only that they did.  <u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Therefore, the current check it does where it returns PartialAlias seems wrong. <u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">George, why does it return PartialAlias?<u></u><u></u></p></div></div></div></div></div></blockquote><p class="MsoNormal">It shouldn't -- unless I misinterpreted an earlier discussion, I was under the impression that we were testing with that line updated to return MayAlias. We do need to update that in LLVM though; thanks for the fix.<u></u><u></u></p><div><p class="MsoNormal"> <u></u><u></u></p></div><div><blockquote style="margin-top:5pt;margin-bottom:5pt"><div><div><div><div><div><p class="MsoNormal">IMHO, you can't ever prove any kind of must-alias or partialalias info with CFL-AA, unless i'm missing something.<u></u><u></u></p></div></div></div></div></div></blockquote><p class="MsoNormal">Agreed. <u></u><u></u></p><div><p class="MsoNormal" style="margin-bottom:12pt"><u></u> <u></u></p><blockquote style="margin-top:5pt;margin-bottom:5pt"><div><div><div><div><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><div><div><div><p class="MsoNormal">I'm not sure from your description that this is a chaining issue. PartialAlias doesn't chain and isn't supposed to, it's a final answer just like NoAlias and MustAlias are. You return partial alias when you have proven that the accesses are overlapping, meaning that it is proven to neither be no alias nor must alias.<u></u><u></u></p></div></div></div></div></blockquote><div><p class="MsoNormal">Well, it's still chaining wrong, because it did not change on MayAlias, but you are right that it is not the issue i identified :)<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Anyway, updated patch attached.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><div><div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Nick<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><div><div><div><div><p class="MsoNormal">I've attached a patch that fixes it, but truthfully, chaining seems somewhat badly designed IMHO.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">It should let you pass along the result you've gotten so far, so that you don't have CFLAA get PartialAlias, chain, and have BasicAA get MayAlias.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">(IE it should let it work strictly down the hierarchy).<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Note that this patch breaks the CFLAliasAnalysis tests because it no longer returns PartialAlias in some cases it is expecting it.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">I don't have time ATM to fix chaining completely, so if someone wants to shepherd this patch through, that would be appreciated.<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><div><div><p class="MsoNormal"> <u></u><u></u></p></div></div></div></div><div><div><div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">On Tue, Jan 13, 2015 at 8:58 PM, Daniel Berlin <<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>> wrote:<u></u><u></u></p><blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><p class="MsoNormal">Can you send me actual LLVM IR or a preprocessed source from using -E?<br>I don't have a machine handy that has headers that target that arch.<u></u><u></u></p><div><div><div><p class="MsoNormal"> <u></u><u></u></p></div><p class="MsoNormal"> <u></u><u></u></p><div><p class="MsoNormal">On Tue Jan 13 2015 at 4:33:29 PM Daniel Berlin <<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>> wrote:<u></u><u></u></p><blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><p>Anything other than noalias or mustalias should be getting passed down the stack, so either that is not happening or CFL aa is giving better answers and something does worse with those better answers.  I'll take a look this evening<u></u><u></u></p><div><p class="MsoNormal">On Jan 13, 2015 3:58 PM, "Ana Pazos" <<a href="mailto:apazos@codeaurora.org" target="_blank">apazos@codeaurora.org</a>> wrote:<u></u><u></u></p><blockquote style="border-style:none none none solid;border-left-color:rgb(204,204,204);border-left-width:1pt;padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt"><p class="MsoNormal">Hi folks,<br><br>Moving the discussion to llvm.dev.<br><br>None of the changes we talked earlier help.<br><br>Find attached the C source code that you can use to reproduce the issue.<br><br>clang --target=aarch64-linux-gnu  -c -mcpu=cortex-a57 -Ofast   -fno-math-errno   test.c -S -o test.s  -mllvm -debug-only=licm<br>LICM hoisting to <a href="http://while.body.lr.ph" target="_blank">while.body.lr.ph</a>:   %21 = load double** %arrayidx8, align 8, !tbaa !5<br>LICM hoisting to <a href="http://while.body.lr.ph" target="_blank">while.body.lr.ph</a>:   %arrayidx72 = getelementptr inbounds double* %11, i64 1<br>LICM hoisting to <a href="http://while.body.lr.ph" target="_blank">while.body.lr.ph</a>:   %arrayidx81 = getelementptr inbounds double* %11, i64 2<br>LICM hoisting to <a href="http://for.body.lr.ph" target="_blank">for.body.lr.ph</a>:   %2 = ptrtoint i32* %Index to i64<br><br>clang --target=aarch64-linux-gnu  -c   -mcpu=cortex-a57  -Ofast   -fno-math-errno   test.c -S -o test-cflaa.s -mllvm -use-cfl-aa -mllvm -debug-only=licm<br>LICM hoisting to <a href="http://for.body.lr.ph" target="_blank">for.body.lr.ph</a>:   %2 = ptrtoint i32* %Index to i64<br><br>Why CFL AA cannot allow hoisting this out:  %21 = load double** %arrayidx8, align 8, !tbaa !5<br><br>Which leads to this extra load in assembly code: ldr    x14, [x4, x9, lsl #3]<br><br>Thanks!<br>Ana.<br><br>-----Original Message-----<br>From: Hal Finkel [mailto:<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>]<br>Sent: Tuesday, January 13, 2015 12:51 AM<br>To: Chandler Carruth<br>Cc: Jiangning Liu; Pazos, Ana; Ana Pazos; Daniel Berlin; George Burgess IV<br>Subject: Re: question about enabling cfl-aa and collecting a57 numbers<br><br>----- Original Message -----<br>> From: "Chandler Carruth" <<a href="mailto:chandlerc@gmail.com" target="_blank">chandlerc@gmail.com</a>><br>> To: "Ana Pazos" <<a href="mailto:apazos@codeaurora.org" target="_blank">apazos@codeaurora.org</a>>, "Daniel Berlin" <<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>>, "George Burgess IV"<br>> <<a href="mailto:george.burgess.iv@gmail.com" target="_blank">george.burgess.iv@gmail.com</a>>, "Hal Finkel" <<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>><br>> Cc: "Jiangning Liu" <<a href="mailto:Jiangning.Liu@arm.com" target="_blank">Jiangning.Liu@arm.com</a>>, "Ana Pazos"<br>> <<a href="mailto:apazos@quicinc.com" target="_blank">apazos@quicinc.com</a>><br>> Sent: Monday, January 12, 2015 6:43:44 PM<br>> Subject: Re: question about enabling cfl-aa and collecting a57 numbers<br>><br>> Not quite:<br>><br>><br>> On Mon Jan 12 2015 at 4:27:30 PM Ana Pazos < <a href="mailto:apazos@codeaurora.org" target="_blank">apazos@codeaurora.org</a> ><br>> wrote:<br>><br>> Thanks George and Daniel,<br>><br>><br>><br>> If the recommended order is “–basicaa –cfla-aa” it means we should fix<br>> the trunk code that processes the flags -mllvm use-cfl-aa-in-codegen<br>> and –mllvm use-cfl-aa, right?<br>><br>><br>><br>> In Transforms/IPO/PassManagerBuilder.cpp and CodeGen/Passes.cpp we see<br>> this sequence:<br>><br>><br>><br>> if (UseCFLAA)<br>><br>> PM.add(createCFLAliasAnalysisPass());<br>><br>> PM.add(createTypeBasedAliasAnalysisPass());<br>><br>> PM.add(createScopedNoAliasAAPass());<br>><br>> PM.add(createBasicAliasAnalysisPass());<br>><br>><br>><br>> So are you recommending changing to the sequence below instead?<br>><br>><br>> Not quite:<br>><br>><br>> addPass(createTypeBasedAliasAnalysisPass());<br>><br>> addPass(createScopedNoAliasAAPass());<br>> You want it here.<br>><br>> addPass(createBasicAliasAnalysisPass());<br>><br>> if (UseCFLAA)<br>><br>> addPass(createCFLAliasAnalysisPass());<br>><br>><br>> The way to think about this is as follows:<br>><br>><br>> if TBAA or ScopedNoAlias *can* return results, you want them to. They<br>> are reflecting a-priori knowledge of aliasing.<br>><br>><br>> if both of those say "maybe", you want to ask CFL. If CFL says "maybe"<br>> you want to ask "BasicAA".<br><br>I could very well be misunderstanding something, but I recall that we add BasicAA last so that it will be queried first. We do this because of our BasicAA delegation hack: We want a MustAlias from BasicAA to override a NoAlias from TBAA, so that we can catch cases of basic local type punning. Thus, assuming CFL delegates properly, I fail to see how switching its order w.r.t. the metadata-based analysis changes anything.<br><br> -Hal<br><br>><br>><br>> It's possible that you could as a compile-time hack flip the last two<br>> to your suggested ordering, but a) it should really only be a compile<br>> time hack, and b) we haven't really tested that BasicAA actually<br>> delegates rather than directly returning "maybe".<br>><br>><br>> Thanks,<br>><br>> Ana.<br>><br>><br>><br>> From: Daniel Berlin [mailto: <a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a> ]<br>> Sent: Friday, January 09, 2015 6:41 PM<br>> To: George Burgess IV; Hal Finkel<br>> Cc: Ana Pazos; Pazos, Ana; Jiangning Liu; chandlerc<br>><br>><br>> Subject: Re: question about enabling cfl-aa and collecting a57 numbers<br>><br>><br>> Right. I would not try with -cfl-aa -basicaa as the order, it should<br>> be the other way around.<br>><br>><br>> If you discover performance regressions with *that*, that would be<br>> highly interesting.<br>><br>><br>> On Fri Jan 09 2015 at 6:32:28 PM George Burgess IV <<br>> <a href="mailto:george.burgess.iv@gmail.com" target="_blank">george.burgess.iv@gmail.com</a> > wrote:<br>><br>><br>><br>> Thanks for the notes and observations Ana! :)<br>><br>> >> Hal, what do you think? Does it meant that cfl-aa is more<br>> >> conservative (note I set the right order -cfa-aa followed by<br>> >> -basicaa)?<br>> Currently, yes. The implementation as it is is focused heavily on<br>> being fast, and on trying to cover cases that BasicAA can’t easily<br>> cover itself. If our end goal is to use this as a replacement for<br>> BasicAA, there’s probably quite a few low-hanging fruit for accuracy<br>> improvements, and we can start playing with sacrificing speed in<br>> pursuit of greater accuracy. On the other hand, if the end goal is to<br>> append this pass to the list of AA passes already being performed,<br>> then I’d be interested in seeing the difference in perf between<br>> `-basicaa` and `-basicaa -cfl-aa`, if any.<br>><br>> WRT this issue in particular, I believe CFLAA answers conservatively<br>> because:<br>> A. it doesn’t take into account constant pointer offsets (i.e. it<br>> considers a[0]..a[n] all as the same “address”) B. CFLAA is entirely<br>> context insensitive<br>><br>> IIRC, BasicAA is somewhat context sensitive, and it does take into<br>> account constant pointer offsets, so it can be more accurate in this<br>> case. That being said, I don’t have access to the SPEC code, so I can<br>> only speculate. :)<br>><br>> George<br>><br>> > On Jan 9, 2015, at 4:25 PM, Hal Finkel < <a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a> > wrote:<br>> ><br>> > Ana,<br>> ><br>> > Thanks so much for looking into this. I'm adding some additional<br>> > relevant people to the CC line...<br>> ><br>> > -Hal<br>> ><br>> > ----- Original Message -----<br>> >> From: "Ana Pazos" < <a href="mailto:apazos@codeaurora.org" target="_blank">apazos@codeaurora.org</a> ><br>> >> To: "Ana Pazos" < <a href="mailto:apazos@quicinc.com" target="_blank">apazos@quicinc.com</a> >, "Hal Finkel" <<br>> >> <a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a> >, "Jiangning Liu" < <a href="mailto:Jiangning.Liu@arm.com" target="_blank">Jiangning.Liu@arm.com</a> ><br>> >> Sent: Friday, January 9, 2015 3:12:04 PM<br>> >> Subject: RE: question about enabling cfl-aa and collecting a57<br>> >> numbers<br>> >><br>> >> Hi Hal and Jiangning,<br>> >><br>> >> I started to look at the effect of cfl-aa on SPEC.<br>> >><br>> >> The first observation is that I see more redundant loads not being<br>> >> hoisted out of loops by LICM.<br>> >><br>> >> Due to license restrictions, I cannot paste SPEC code here, but I<br>> >> think you have access to it.<br>> >><br>> >> I tried to simplify a top function in equake (quake.c smvp) to show<br>> >> the issue. See the attached reduced test case.<br>> >><br>> >> If you look at the the source code you will see something like:<br>> >> for {<br>> >> ...load v[i][0]...<br>> >> while {<br>> >> ...load v[i][0]...<br>> >> store w[col][0]....<br>> >> }<br>> >> ...load w[i][0]...<br>> >> store w[i][0]...<br>> >> }<br>> >><br>> >> It should be possible to avoid load &v[i][0], &v[i][1], &vi[i][2]<br>> >> inside the while loop.<br>> >><br>> >> In the simplified example that would be this instruction:<br>> >> %21 = load double** %arrayidx8, align 8, !tbaa !5<br>> >><br>> >> And the pointer for the load instruction:<br>> >> %arrayidx8 = getelementptr inbounds double** %v, i64 %idxprom<br>> >><br>> >> The decision to hoist it fails at LICM.cpp:189: AliasSet &AS =<br>> >> CurAST->getAliasSetForPointer(V, Size, AAInfo).isMod.<br>> >><br>> >> With basicaa, only loads are in the alias set, but with cfl-aa you<br>> >> find loads and stores, so isMod returns true.<br>> >><br>> >> AliasSet with basicaa:<br>> >> AliasSet[0x2b35aa0, 7] may alias, Ref Pointers: (double***<br>> >> %arrayidx32, 8), (double** %12, 8), (double** %arrayidx36, 8),<br>> >> (double** %arrayidx8, 8), (double** %arrayidx68, 8), (double**<br>> >> %arrayidx77, 8), (double** %arrayidx85, 8)<br>> >> $5 = void<br>> >><br>> >> AliasSet with cfa-aa:<br>> >> AliasSet[0x2b37df0, 20] may alias, Mod/Ref Pointers: (i32*<br>> >> %arrayidx30, 4), (double*** %arrayidx32, 8), (double** %12, 8),<br>> >> (double* %13, 8), (double** %arrayidx36, 8), (double* %15, 8),<br>> >> (double* %arrayidx42, 8), (double* %arrayidx45, 8), (double*<br>> >> %arrayidx51, 8), (double* %arrayidx54, 8), (double** %arrayidx8,<br>> >> 8), (double* %21, 8), (double** %arrayidx68, 8), (double* %23, 8),<br>> >> (double* %arrayidx72, 8), (double** %arrayidx77, 8), (double* %26,<br>> >> 8), (double* %arrayidx81, 8), (double** %arrayidx85, 8), (double*<br>> >> %29, 8)<br>> >> $8 = void<br>> >><br>> >> You can reproduce it with the commands:<br>> >> opt -O3 -S -cfl-aa -basicaa -licm -debug-only=licm reduce.ll -o out<br>> >><br>> >> opt -O3 -S - -basicaa -licm -debug-only=licm reduce.ll -o out LICM<br>> >> hoisting to <a href="http://while.body.lr.ph" target="_blank">while.body.lr.ph</a> : %21 = load double** %arrayidx8,<br>> >> align 8, !tbaa !5 LICM hoisting to <a href="http://while.body.lr.ph" target="_blank">while.body.lr.ph</a> : %arrayidx72 =<br>> >> getelementptr inbounds double* %11, i64 1 LICM hoisting to<br>> >> <a href="http://while.body.lr.ph" target="_blank">while.body.lr.ph</a> : %arrayidx81 = getelementptr inbounds double*<br>> >> %11, i64 2<br>> >><br>> >> Hal, what do you think? Does it meant that cfl-aa is more<br>> >> conservative (note I set the right order -cfa-aa followed by<br>> >> -basicaa)? Could it be an issue with building the AliasSet tracker?<br>> >> Any pointers on how to fix this?<br>> >><br>> >> Thanks,<br>> >> Ana.<br>> >><br>> >><br>> >><br>> >> -----Original Message-----<br>> >> From: Jiangning Liu [mailto: <a href="mailto:Jiangning.Liu@arm.com" target="_blank">Jiangning.Liu@arm.com</a> ]<br>> >> Sent: Wednesday, December 24, 2014 6:27 PM<br>> >> To: Hal Finkel; Ana Pazos<br>> >> Subject: RE: question about enabling cfl-aa and collecting a57<br>> >> numbers<br>> >><br>> >> Hi,<br>> >><br>> >> I saw big regressions on cortex-A57 for the following SPEC<br>> >> benchmarks after using "-mllvm -use-cfl-aa ".<br>> >><br>> >> spec.cpu2006.ref.462_libquantum 9.22% spec.cpu2000.ref.179_art<br>> >> 5.32%<br>> >> spec.cpu2000.ref.256_bzip2 4.91%<br>> >><br>> >> Thanks,<br>> >> -Jiangning<br>> >><br>> >>> -----Original Message-----<br>> >>> From: Hal Finkel [mailto: <a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a> ]<br>> >>> Sent: Wednesday, December 24, 2014 3:56 AM<br>> >>> To: Ana Pazos<br>> >>> Cc: Jiangning Liu<br>> >>> Subject: Re: question about enabling cfl-aa and collecting a57<br>> >>> numbers<br>> >>><br>> >>> ----- Original Message -----<br>> >>>> From: "Ana Pazos" < <a href="mailto:apazos@codeaurora.org" target="_blank">apazos@codeaurora.org</a> ><br>> >>>> To: "Hal Finkel" < <a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a> >, "Jiangning Liu"<br>> >>>> < <a href="mailto:Jiangning.Liu@arm.com" target="_blank">Jiangning.Liu@arm.com</a> ><br>> >>>> Sent: Monday, December 22, 2014 4:25:07 PM<br>> >>>> Subject: question about enabling cfl-aa and collecting a57<br>> >>>> numbers<br>> >>>><br>> >>>><br>> >>>><br>> >>>><br>> >>>> Hi Hal,<br>> >>>><br>> >>>><br>> >>>><br>> >>>> Can you clarify to enable cfl-aa from clang we need both these<br>> >>>> flags?<br>> >>>><br>> >>>><br>> >>><br>> >>> Hi Ana,<br>> >>><br>> >>> Thanks for following-up on this! You only need (-mllvm<br>> >>> -use-cfl-aa)<br>> >>> to<br>> >>> use CFL AA during the main optimization pipeline, and just this is<br>> >>> enough to reproduce the performance regressions as far as I know.<br>> >>> You<br>> >>> can also use CFL AA during code generation (-mllvm<br>> >>> -use-cfl-aa-in-codegen), which matters only if your using AA at<br>> >>> all for code generation (which AArch64 does only for the<br>> >>> Cortex/A53).<br>> >>><br>> >>> -Hal<br>> >>><br>> >>>><br>> >>>> -mllvm -use-cfl-aa<br>> >>>><br>> >>>> -mllvm -cfl-aa-in-codegen<br>> >>>><br>> >>>><br>> >>>><br>> >>>> Hi Jiangning,<br>> >>>><br>> >>>> Did you collect a57 perf results for SPEC 2000 and 2006 enabling<br>> >>>> these two flags?<br>> >>>><br>> >>>> Did you notice any correctness and performance regression?<br>> >>>><br>> >>>><br>> >>>><br>> >>>><br>> >>>><br>> >>>> Thanks,<br>> >>>><br>> >>>> Ana.<br>> >>>><br>> >>>><br>> >>>><br>> >>>><br>> >>>><br>> >>>> Ana Pazos<br>> >>>> Qualcomm Innovation Center, Inc.<br>> >>>> The Qualcomm Innovation Center, Inc. is a member of the Code<br>> >>>> Aurora Forum, a Linux Foundation Collaborative Project.<br>> >>>><br>> >>>><br>> >>>><br>> >>>><br>> >>>><br>> >>>><br>> >>><br>> >>> --<br>> >>> Hal Finkel<br>> >>> Assistant Computational Scientist<br>> >>> Leadership Computing Facility<br>> >>> Argonne National Laboratory<br>> >><br>> >><br>> >> -- IMPORTANT NOTICE: The contents of this email and any attachments<br>> >> are confidential and may also be privileged. If you are not the<br>> >> intended recipient, please notify the sender immediately and do not<br>> >> disclose the contents to any other person, use it for any purpose,<br>> >> or store or copy the information in any medium. Thank you.<br>> >><br>> >> ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1<br>> >> 9NJ, Registered in England & Wales, Company No: 2557590 ARM<br>> >> Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1<br>> >> 9NJ, Registered in England & Wales, Company No: 2548782<br>> >><br>> ><br>> > --<br>> > Hal Finkel<br>> > Assistant Computational Scientist<br>> > Leadership Computing Facility<br>> > Argonne National Laboratory<br><br>--<br>Hal Finkel<br>Assistant Computational Scientist<br>Leadership Computing Facility<br>Argonne National Laboratory<u></u><u></u></p></blockquote></div></blockquote></div></div></div></blockquote></div><p class="MsoNormal"> <u></u><u></u></p></div></div></div><p class="MsoNormal"> <u></u><u></u></p></div></div><p class="MsoNormal" style="margin-bottom:12pt">_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><u></u><u></u></p></blockquote></div><p class="MsoNormal"> <u></u><u></u></p></div></div></blockquote></div><p class="MsoNormal"> <u></u><u></u></p></div></div></div></blockquote><blockquote style="margin-top:5pt;margin-bottom:5pt"><div><p class="MsoNormal"><cflaafix.diff><u></u><u></u></p></div></blockquote></div></div></div></div></div></div></div></div></div></blockquote></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div></div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>