<div dir="ltr">Hi Anna,<div>Sounds good.</div><div><br></div><div>If you touch invariant.end (and not just invariant.start) :</div><div><br></div><div>You should add a testcase to make sure that invariant.start's don't get value forwarded to other invariant starts of the same result :)</div><div><br></div><div>IE </div><div><br></div><div>%foo = llvm.invariant.start(%ptr)</div><div>...</div><div>llvm.invariant.end(%foo)<br><div><scalar code in same block></div><div>%bar = llvm.invariant.start(%ptr)</div></div><div>llvm.invariant.end(%bar)</div><div><br></div><div>While readonly, if you can prove the memory state is the same, it may become smart enough to decide it can forward the values now, and replace %bar with %foo.</div><div><br></div><div>If you leave invariant.end read/write, this should not happen, of course.</div><div><br></div><div>But might be worth adding a testcase anyway so it doesn't break in the future :)</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 5, 2016 at 3:58 PM, Anna Thomas <span dir="ltr"><<a href="mailto:anna@azul.com" target="_blank">anna@azul.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
Thanks Daniel, Sanjoy.<br>
<div><br>
</div>
<div>I’ll be making the changes in the alias analysis getModRefInfo instead of within the MDA. getModRefInfo is used by MDA, so the implications on the various passes (GVN, Memcpyopt and DSE) should be the same, </div>
<div>it’s just that the code change will be within the same code region where other special cases exist :)</div><span class="HOEnZb"><font color="#888888">
<div><br>
</div>
</font></span><div><span class="HOEnZb"><font color="#888888">Anna</font></span><div><div class="h5"><br>
<div>
<div><br>
<div>
<blockquote type="cite">
<div>On Aug 5, 2016, at 3:36 PM, Daniel Berlin <<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>> wrote:</div>
<br>
<div>
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span>> That said, in theory:<br>
><br>
> %a = add 5, 3<br>
> bar = invariant.start(foo, 5)<br>
> load foo<br>
> invariant.end(bar)<br>
><br>
> to<br>
> bar = invariant.start(foo, 5)<br>
> %a = add 5, 3<br>
> load foo<br>
> invariant.end(bar)<br>
><br>
> is probably also illegal, and has the same issues :)<br>
<br>
</span>I don't understand why that ^ is a problem.<span><br>
<br>
</span></blockquote>
<div><br>
</div>
<div>You have extended the scope :)</div>
<div><br>
</div>
<div>Even if the extension is not meaningful :)<br>
<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span>> With the memdep changes we will allow reordering loads across the<br>
> invarinat_start call:<br>
><br>
> int val = *ptr;<br>
> invariant_start(ptr)<br>
><br>
> <==><br>
><br>
> int val = *ptr;<br>
> invariant_start(ptr)<br>
><br>
><br>
> (you meant for the first one to have the load after invariant start, i<br>
> presume)<br>
<br>
</span>I meant given what we're teaching MDA, the two are equivalent (hence<br>
the "bidirectional arrow" :)).</blockquote>
<div><br>
</div>
<div>I meant that the examples are identical</div>
<div> :)<br>
<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><br>
<br>
> I'm willing to give it a shot if you want, i'm just in the "we'll<br>
> probably break something unexpected" camp :)<br>
<br>
</span>I now think it is better to add one more special case to AliasAnalysis<br>
around invariant_start s, like we do for assumes. It's a hack, but at<br>
least a localized hack.</blockquote>
<div><br>
</div>
<div>I already added the same hack to memoryssa, so i can't complain :)</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><font color="#888888"><br>
<br>
-- Sanjoy<br>
</font></span></blockquote>
</div>
<br>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
</div></div></div>
</div>
</blockquote></div><br></div>