(&mut self)
| 586 | } |
| 587 | |
| 588 | fn dce(&mut self) { |
| 589 | // Truncate instructions after terminal instructions within each block |
| 590 | for block in &mut self.blocks { |
| 591 | let mut last_instr = None; |
| 592 | for (i, ins) in block.instructions.iter().enumerate() { |
| 593 | if ins.instr.is_scope_exit() || ins.instr.is_unconditional_jump() { |
| 594 | last_instr = Some(i); |
| 595 | break; |
| 596 | } |
| 597 | } |
| 598 | if let Some(i) = last_instr { |
| 599 | block.instructions.truncate(i + 1); |
| 600 | } |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | /// Clear blocks that are unreachable (not entry, not a jump target, |
| 605 | /// and only reachable via fall-through from a terminal block). |
no test coverage detected