(blocks: &[Block], reachable_blocks: &[bool])
| 68 | } |
| 69 | |
| 70 | fn compute_preds(blocks: &[Block], reachable_blocks: &[bool]) -> Vec<Vec<usize>> { |
| 71 | let mut result = vec![vec![]; blocks.len()]; |
| 72 | // Do not count unreachable blocks as valid preds of blocks |
| 73 | for (source_idx, source) in blocks |
| 74 | .iter() |
| 75 | .enumerate() |
| 76 | .filter(|&(b, _)| reachable_blocks[b]) |
| 77 | { |
| 78 | for dest_id in outgoing_edges(source) { |
| 79 | let dest_idx = label_to_index(blocks, dest_id); |
| 80 | result[dest_idx].push(source_idx); |
| 81 | } |
| 82 | } |
| 83 | result |
| 84 | } |
| 85 | |
| 86 | // Paper: A Simple, Fast Dominance Algorithm |
| 87 | // https://www.cs.rice.edu/~keith/EMBED/dom.pdf |
no test coverage detected