(blocks: &[Block])
| 2692 | } |
| 2693 | |
| 2694 | fn compute_predecessors(blocks: &[Block]) -> Vec<u32> { |
| 2695 | let mut predecessors = vec![0u32; blocks.len()]; |
| 2696 | if blocks.is_empty() { |
| 2697 | return predecessors; |
| 2698 | } |
| 2699 | |
| 2700 | predecessors[0] = 1; |
| 2701 | let mut current = BlockIdx(0); |
| 2702 | while current != BlockIdx::NULL { |
| 2703 | let block = &blocks[current.idx()]; |
| 2704 | if block_has_fallthrough(block) { |
| 2705 | let next = next_nonempty_block(blocks, block.next); |
| 2706 | if next != BlockIdx::NULL { |
| 2707 | predecessors[next.idx()] += 1; |
| 2708 | } |
| 2709 | } |
| 2710 | for ins in &block.instructions { |
| 2711 | if ins.target != BlockIdx::NULL { |
| 2712 | let target = next_nonempty_block(blocks, ins.target); |
| 2713 | if target != BlockIdx::NULL { |
| 2714 | predecessors[target.idx()] += 1; |
| 2715 | } |
| 2716 | } |
| 2717 | } |
| 2718 | current = block.next; |
| 2719 | } |
| 2720 | predecessors |
| 2721 | } |
| 2722 | |
| 2723 | fn duplicate_exits_without_lineno(blocks: &mut Vec<Block>, predecessors: &mut Vec<u32>) { |
| 2724 | let mut current = BlockIdx(0); |
no test coverage detected