class SyntaxTree::YARV::ControlFlowGraph::Compiler
def prune_basic_blocks(blocks)
If there are blocks that are unreachable, we can remove them from the
def prune_basic_blocks(blocks) visited = Set.new queue = [blocks.fetch(0)] until queue.empty? current_block = queue.shift next if visited.include?(current_block) visited << current_block queue.concat(current_block.outgoing_blocks) end blocks.select! { |_, block| visited.include?(block) } end