<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 11, 2016 at 5:48 PM, Wei Mi <span dir="ltr"><<a href="mailto:wmi@google.com" target="_blank">wmi@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Note: Stretched vars are not only affecting performance of Value<br>
Propagation, but also register allocation (Reg Splitting). As Daniel<br>
said, for the compile time problem in Value Propagation, it could be<br>
solved in an eager way.  But it still hurts the compile time of reg<br>
alloca for which I don't have an easy solution.<br></blockquote><div><br></div><div>There are not always easy solutions. But at some point, we have to do what we need to do :)</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Actually I am not convinced that doing LICM as many as possible is<br>
indispensible to canonicalize IR. As far as I know, Gcc throttle LICM<br>
too, in middle end. </blockquote><div><br></div><div>GCC has two things that do LICM, PRE and tree-loop-licm.</div><div><br></div><div>PRE does whatever it wants. It is not throttled by register pressure.</div><div><br></div><div>tree-ssa-im.c (LICM) is more restrained, and has a cost calculation for how expensive something is to move.</div><div><br></div><div>(the next question is usually: what cases do the two cover.  In GCC, PRE will get loads and scalars. LICM will do those and stores.  LICM tries as bunch harder to identify the specific case of  loop invariant expressions that are equivalent.  </div><div>At one point, because there was no alias oracle in GCC, LICM got more loads. I"m not sure this is true anymore, and not sure anyone has checked to see if it does anything with loads/scalars anymore)</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
And I don't think doing opt aggressively without known benefit and<br>
then nullify it is a good idea.</blockquote><div><br></div><div>This is a common point of contention in compilers.</div><div>IME, most compilers fall on the side of "we don't try to take register pressure into account in the middle, because it's really hard to say what is going to happen 10+ passes down the road, and not easy to estimate accurately on today's architectures".</div><div><br></div><div>GCC and LLVM definitely fall into that case.</div><div><br></div></div></div></div>