Returns `true` if `block_a` dominates `block_b`. A block is considered to dominate itself.
(&self, block_a: Block, mut block_b: Block)
| 151 | /// |
| 152 | /// A block is considered to dominate itself. |
| 153 | fn block_dominates(&self, block_a: Block, mut block_b: Block) -> bool { |
| 154 | let rpo_a = self.nodes[block_a].rpo_number; |
| 155 | |
| 156 | // Run a finger up the dominator tree from b until we see a. |
| 157 | // Do nothing if b is unreachable. |
| 158 | while rpo_a < self.nodes[block_b].rpo_number { |
| 159 | let idom = match self.idom(block_b) { |
| 160 | Some(idom) => idom, |
| 161 | None => return false, // a is unreachable, so we climbed past the entry |
| 162 | }; |
| 163 | block_b = idom; |
| 164 | } |
| 165 | |
| 166 | block_a == block_b |
| 167 | } |
| 168 | |
| 169 | /// Compute the common dominator of two basic blocks. |
| 170 | /// |
no test coverage detected