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