<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 class=""><br>
<br>
</span>I understand your argument that after optimizing to a fixed point, we should get the same result.  The problem is that the *order* of iteration will differ.  This can mean differences in naming, memory allocation patterns, or even output (I don't believe GVNPRE actually iterates to a fixed point.)<br></blockquote><div><br></div><div>GVN + PRE these days does iterate to a fixpoint, but it also gives up if it doesn't converge quickly.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> I can continue looping and either try hard to find local dependency or 'the best' non-local dependency (which probably won't be found because GVN will already remove it)<br>
>  and return it, or even collect list of all non local dependencies.<br>
<br>
</span>The key point is that we should return a consistent result, regardless of which query path we see.  Returning the most dominating non-local would be one reasonable scheme.<br>
<span class=""><br>
> I am also not sure if I understand what 'the best' non local dependency means.<br>
<br>
</span>Don't get too caught up on "best" here.  The ordering point above is the primary concern.  A secondary concern is reducing the number of iterations required to reach the fixed point.  Why do multiple full scans if we can bypass all but one with a small amount of extra work?  Particularly work that we know only happens when we have found a useful result and are just trying to find a better one?  (i.e. we're not burning time when we're not making progress.)<br></blockquote><div><br></div><div><br></div><div>+1 to this however. Truthfully, we can always make invariant group loads faster. We could, for example, link them together, etc.</div><div><br></div><div>This is not the thing that is hard to speed up :)</div><div><br></div><div><br></div></div></div></div>