I've thought about this some more, and this approach seems a little too specific
and even a bit hacky, even ignoring the algorithmic complexity.

If this optimization is worth while (BTW, what is the maximum win), it should
apply to all transitions in all blocks, not just pre-headers.

It seems to me that are one of two approaches that seems better, but they are
more work:

1) Add a general pass that make sure that all uses of the input to a transition that are dominated by the transition are canonicalized to the transition. You
might be able to fold this in to the logic in the GVN block processing where
there is special handling of transitions and somehow use the
loop-successor-dominator information so that the additional overhead isn't too
high, but I didn't really do a deep analysis.

2) Tweak the GVN equals check for CheckMaps to treat map checks dominated by
corresponding transition-dependent map check as equal. This is probably a bit tricky, since there are assumptions about calculating the hash code of a HValues based on its inputs, and this change would treat HValues with different inputs
as the same.


https://chromiumcodereview.appspot.com/10544133/diff/6001/src/hydrogen.cc
File src/hydrogen.cc (right):

https://chromiumcodereview.appspot.com/10544133/diff/6001/src/hydrogen.cc#newcode1826
src/hydrogen.cc:1826: }
This is potentially a n^2 algorithm with respect to the number of
instructions in the pre header. This is not the right way to do this.

https://chromiumcodereview.appspot.com/10544133/

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to