As discussed here, there is a check in MakeCompactAndFindExits that seems questionable, at best:
|
if (!BasicBlock::sameEHRegion(previous, nextLoopBlock) || !BasicBlock::sameEHRegion(previous, moveAfter)) |
It tries to avoid creating illegal EH regions by preventing moving blocks. But it doesn't properly handle region adjacency where moving a range of blocks is legal. E.g., a range abutting a try begin.