<div dir="ltr"><div><br></div><div>In any case, if you want to play with it, it's here:</div><div><a href="https://github.com/dberlin/llvm-gvn-rewrite/tree/newgvn-predicateinfo">https://github.com/dberlin/llvm-gvn-rewrite/tree/newgvn-predicateinfo</a><br></div><div><br></div><div>-print-predicateinfo -analyze will give you info.</div><div><br></div><div>-newgvn will process simple equality and inequality right now using that info[1]</div><div><br></div><div>This is pretty much as cheap as you can make it.<br></div><div>We compute it in O(number of uses of comparison operations that are used in terminators) worst case time. </div><div>So it's not even O(number of instructions) unless your program is only comparisons and branches :P<br></div><div><br></div><div>This includes pruning - it will not insert predicate info copies except where they are actually used on a branch.</div><div><br></div><div>(the same O(uses) algorithm works for general SSA renaming as well)</div><div><br></div><div>Adding assume support would just require coming up with a copy operation, and doing local numbering in the assume blocks only (so we get def vs use order right in that block).</div><div><br></div><div>[1] There's a little work to be done, but it's actually very easy at this point to catch 95% of the cases GVN does. It has some ridiculous cases that we would have to insert more predicate info to catch, like this;<br><br></div><div>%tmp1 = load @a</div><div>%tmp2 = icmp eq %tmp1, 0</div><div><div>branch to bb1 if true</div><div><br></div><div>bb1:<br>%tmp3 = load @a</div><div>%tmp4 = icmp eq %tmp3, 4</div></div><div><br></div><div>If you run early-cse or newgvn first, so the loads get eliminated, it will get it. If this case occurs enough in practice, we can also just insert predicateinfo during analysis.</div><div><br></div><div><br></div><div class="gmail_extra"><div class="gmail_quote">On Tue, Jan 10, 2017 at 6:56 PM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</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 bgcolor="#FFFFFF"><span class="gmail-">
<p><br>
</p>
<div class="gmail-m_-2269963011766438045moz-cite-prefix">On 01/10/2017 08:51 PM, Daniel Berlin
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">I think this is fine, because you want it in 4.0.
<div><br>
</div>
<div>We can build the infrastructure for the next thing pretty
quickly, and if that means this lives a few months, so be it.</div>
<br>
<div>I have a working version of e-ssa at this point with no ir
changes that i'm testing (it uses one argument phi nodes like
lcssa, and a side lookup table).</div>
</div>
</blockquote>
<br></span>
Sounds good, thanks! We'll just need to work out exactly how this
will work with assumes, guards, etc. and how far you want to take it
(e.g. at some limit, this becomes SSI).<br>
<br>
-Hal<span class="gmail-"><br>
<br>
<blockquote type="cite">
<div dir="ltr">
<div><br>
</div>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Jan 10, 2017 at 6:39 PM, Hal
Finkel via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.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">hfinkel
added a comment.<br>
<span><br>
In <a href="https://reviews.llvm.org/D28459#642239" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2845<wbr>9#642239</a>,
@davide wrote:<br>
<br>
> In <a href="https://reviews.llvm.org/D28459#642235" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2845<wbr>9#642235</a>,
@davide wrote:<br>
><br>
> > Sorry for the delay, Hal.<br>
> > I just checked and this doesn't regress the
cases your previous change regressed, so we should be good
on that side.<br>
> > I somehow share Dan's feeling that this could
be solved with an infrastructural changes rather than
caching, but I don't feel to be in a position to hinder
progress without a concrete/implemented alternative.<br>
><br>
><br>
> For those wondering, I mean <a href="http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20170102/416193.html" rel="noreferrer" target="_blank">http://lists.llvm.org/pipermai<wbr>l/llvm-commits/Week-of-Mon-<wbr>20170102/416193.html</a><br>
<br>
<br>
</span>@dberlin , @chandlerc , et al. does anyone object to
me committing this solution at this point? I'm obviously
happy to help replace it later with something based on an
extended SSA form once we figure out how that should work.
In the mean time, this fixes the compile-time problems,
which users are certainly hitting, in a fairly transparent
way.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D28459" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2845<wbr>9</a><br>
<br>
<br>
<br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</span><span class="gmail-HOEnZb"><font color="#888888"><pre class="gmail-m_-2269963011766438045moz-signature" cols="72">--
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory</pre>
</font></span></div>
</blockquote></div><br></div></div>