<div dir="ltr">I should have clarified, by 2 calls meant getModRef followed by alias, not two getModRef calls.<div>The timings you got seem to concur, but I'm quite skeptical about the alias call being free...</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 9, 2017 at 7:05 PM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Yes, this is odd.<div><br></div><div>On my clang.bc</div><div><br></div><div><div><div>Without:<br>   2.2967 ( 53.8%)   0.0242 ( 26.4%)   2.3210 ( 53.2%)   2.3227 ( 53.2%)  Memory SSA<br></div><div>   2.3364 ( 53.7%)   0.0246 ( 25.7%)   2.3610 ( 53.1%)   2.3636 ( 53.1%)  Memory SSA<br></div><div>   2.3353 ( 54.0%)   0.0258 ( 27.0%)   2.3611 ( 53.4%)   2.3632 ( 53.3%)  Memory SSA<br></div><div><br></div><div>With two getModRefInfo calls:<br>   3.0302 ( 58.8%)   0.0328 ( 29.9%)   3.0630 ( 58.2%)   3.0858 ( 58.2%)  Memory SSA<br></div><div>   3.0097 ( 58.9%)   0.0325 ( 30.0%)   3.0422 ( 58.3%)   3.0590 ( 58.3%)  Memory SSA</div><div>   3.0486 ( 58.8%)   0.0317 ( 29.4%)   3.0804 ( 58.2%)   3.1331 ( 58.3%)  Memory SSA<br></div></div><div><br></div><div>with alias followed by getModRefInfo </div><div>   2.2487 ( 52.9%)   0.0259 ( 27.1%)   2.2746 ( 52.4%)   2.2820 ( 52.4%)  Memory SSA<br></div><div>etc<br></div><div><br></div><div><br></div><div>Not entirely sure what is going on.</div><div><br></div><div>But if alias is free, problem solved!</div><div><br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 9, 2017 at 4:05 PM, Alina Sbirlea <span dir="ltr"><<a href="mailto:alina.sbirlea@gmail.com" target="_blank">alina.sbirlea@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>On Mon, Oct 9, 2017 at 2:08 PM, Alina Sbirlea <span dir="ltr"><<a href="mailto:alina.sbirlea@gmail.com" target="_blank">alina.sbirlea@gmail.com</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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="m_-1004455370825284124m_6804256043158843896gmail-">On Mon, Oct 9, 2017 at 1:57 PM, 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:1px solid rgb(204,204,204);padding-left:1ex"><span>FWIW:  Bootstrap is probably not a good test of this, there are bugs filed where we end up with tons of loads and stores to test against each other.  That's actually fairly rare in bootstrap, as you can see.</span><div>Let me get you some test cases.</div></blockquote><div><br></div></span><div>SG, thanks! </div></div></div></div></blockquote><div><br></div></span><div>I ran a few quick timings of "<span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px">opt -memoryssa" </span>for gvn_hoist.small.bc in <span style="color:rgb(0,0,0);white-space:pre-wrap">PR28670/PR28832</span>, and a larger version extracted then.</div><div><br></div><div>Reporting: </div><div>mssalimit    /  single call getModRef   /   call getModRef followed by alias().<br></div><div><br></div><div>Smaller test hits the case with 2 alias calls 1282 times. Timings, average over 5-10 runs (s):</div><div>100 / <span style="font-size:13.3333px;text-align:right">8.99 / </span><span style="font-size:13.3333px;text-align:right">8.87</span></div><div><span style="font-size:13.3333px;text-align:right">200 / 9.24 / 9.113</span></div><div><span style="font-size:13.3333px;text-align:right">500 / 48.228 / 48.453</span></div><div><span style="font-size:13.3333px;text-align:right"><br></span></div><div><span style="font-size:13.3333px;text-align:right">Larger case hits it 1872 times. </span>Timings, average over 5 runs (s):</div><div><span style="font-size:13.3333px;text-align:right">100 / 23.575 / 23.962</span></div><div><span style="font-size:13.3333px;text-align:right">200 /  </span>23.874 / 23.848</div><div><div class="m_-1004455370825284124h5"><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="m_-1004455370825284124m_6804256043158843896gmail-h5"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>My guess is that we should go with mustmod.</div><div><br></div><div><br></div><div>As for callsites, adding mustmod works for call, memloc and call, call testing.</div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div> </div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="m_-1004455370825284124m_6804256043158843896gmail-m_2516116067676624397m_-2259333034096222757HOEnZb"><div class="m_-1004455370825284124m_6804256043158843896gmail-m_2516116067676624397m_-2259333034096222757h5"><div><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Oct 9, 2017, 4:48 PM Alina Sbirlea <<a href="mailto:alina.sbirlea@gmail.com" target="_blank">alina.sbirlea@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>This came up in <a href="https://reviews.llvm.org/D38569" target="_blank">https://reviews.llvm.org/D3856<wbr>9</a>, and I'd like some input on what's the best way to get alias and mod-ref info without having two alias calls.</div><div><br></div><div>A couple of ideas:</div><div>(a) Extend the getModRefInfo interface (+getModRefBehavior, +gerArgModRefInfo) to return a pair {ModRefInfo, AliasResult}. </div><div><br></div><div>The AliasResult can be optional based on an argument</div><div>     e.g.:</div><div>    struct MRI_AR { ModRefInfo MRI, AliasResult AR };</div><div>    MRI_AR getModRefInfoAlias (LoadInst *LI, MemoryLocation Loc, bool SetAliasResultField);</div><div><br></div><div>Add wrapper APIs to preserve current calls.<br>    e.g.:<br>     ModRefInfo getModRefInfo (LoadInst *LI, MemoryLocation Loc) {<br>          return getModRefInfoAlias (LI, Loc, false).MRI;<br>      }</div><div><br>(b) From talking offline with George, introducing a MRI_MustMod in ModRefInfo.</div><div><br></div><div><br></div><div>Open question: How to handle callsites.</div><div><br></div><div><br></div><div>In terms of whether this is worth doing, as a preliminary timing test I timed the llvm bootstrap build with 1 vs 2 alias calls in D38569: <span style="background-color:rgba(151,234,151,0.6);color:rgb(0,0,0);font-family:Menlo,Consolas,Monaco,monospace;font-size:11px;white-space:pre-wrap">instructionClobbersQue<wbr>ry:296</span>, and got the following:</div><div><div>2 alias calls:</div>real    62m52.627s<br>user    2769m46.964s<br>sys     17m48.072s<div>1 alias call:</div>real    62m56.659s<br>user    2766m40.452s<br>sys     17m46.312s</div><div><br></div><div>Thoughts?</div><div><br></div><div><br></div><div>Thanks,</div><div>Alina</div><div><br></div><div><br></div><div><br></div></div>
</blockquote></div></div>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>