Optimize IterInit[K] and IterNext[K] in HHBBC better (take 2)
Summary:
Do a better analysis of things being iterated over to enable better
optimizations of IterInit[K] and IterNext[K]. Namely, if we definitely know we
won't enter the iteration loop (for example, if the input array is known to be
empty, or something that isn't an array), we can mark the loop body as
unreachable and not consider its effects. Likewise, if we know we'll always
enter the iteration loop (for example, if the input array is known to be
non-empty), we can consider IterInit's fallthrough case to be unreachable. If we
know the thing being iterated over is an array that's not bigger than one
element, we can optimize away an IterNext into just an IterFree with
fall-through (because it will never loop).
This is the second take on this diff, adding back the logic to merge together
iterator state.
Reviewed By: markw65
Differential Revision:
D5805619
fbshipit-source-id:
6dc4c71819cf84b1356ff049bcc3478781dd55bc