<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, May 1, 2014 at 1:01 PM, Nick Lewycky <span dir="ltr"><<a href="mailto:nlewycky@google.com" target="_blank">nlewycky@google.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=""><div class="gmail_extra"><div class="gmail_quote">On 1 May 2014 11:12, Rafael EspĂ­ndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@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>On 1 May 2014 14:08, Reid Kleckner <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>> wrote:<br>


> I talked about this with Nick in person months ago, and my understanding is<br>
> that GlobalOpt is also an enabling optimization that needs to run early.<br>
> For example, if we can eliminate an initializer to an internal global with<br>
> no other stores to it, we can propagate the result.<br>
><br>
> Maybe we should run it twice.<br>
<br>
</div>That is probably fine, we just have to make sure compile time doesn't<br>
surfer too much.<br></blockquote><div></div></div><br></div></div><div class="gmail_extra">There are many cases where another run of globalopt at the end would clean things up.</div><div class="gmail_extra"><br></div><div class="gmail_extra">


I have a few concerns. One is that globalopt can miscompile, and I'm afraid of making it do more or learn new tricks because that may expose its miscompiley underbelly. The second is that a late run of globalopt opens up all manner of new opportunities for the rest of the scalar optimizers, which we don't run again. That's a sign that we should be designing it differently, I just haven't thought about how exactly.</div>
</div></blockquote><div><br></div><div>OK, you've said you don't want to teach globalopt any new tricks, so I'm going to suggest teaching it a new trick ;)</div><div><br></div><div>If globalopt sees the load of a variable but doesn't have a definition of that variable, could it succeed and track that it has an unusable value (but fail if that value is actually used anywhere)? This is perhaps just addressing the symptom rather than the root cause, but it'd work for this case (where the only reason globalopt can't symbolically execute the function is because it loads and ignores an undefined global).</div>
</div></div></div>