Don't select backward edges in WholeCFG mode
commit5fdf8c3748ac42caced022cc1edefc03758ffe91
authorBert Maher <bertrand@fb.com>
Thu, 24 Jul 2014 21:10:49 +0000 (24 14:10 -0700)
committerfacebook-github-bot <githubbot@fb.com>
Thu, 24 Jul 2014 21:30:16 +0000 (24 14:30 -0700)
treea7f323d19b75e9146d66ae7d6e6d7c0d4630e08d
parentddc2de413d6d36e5374ffd13023ff35f3822c946
Don't select backward edges in WholeCFG mode

Summary: The back end will no longer weasel out of back edges by creating
unasked-for side exits.  This is good in the long term but right now it creates
a lot more hard cases for WholeCFG mode.  So, let's modify the region selector
to only pick acyclic regions.  We'll lift the restriction in the future.

The algorithm is your standard depth-first search cycle detection; we maintain
a stack of things being visited, and any edge to something currently on the
stack is by definition a back edge.  This is much easier to express as a
recursive algorithm than as a worklist algorithm, so I converted it to that
style.

Reviewed By: @ottoni

Differential Revision: D1446071
hphp/runtime/vm/jit/region-selection.h
hphp/runtime/vm/jit/region-whole-cfg.cpp