MCPcopy Index your code
hub / github.com/RustPython/RustPython / dce

Method dce

crates/codegen/src/ir.rs:588–602  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

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).

Callers 1

finalize_codeMethod · 0.80

Calls 5

is_scope_exitMethod · 0.80
is_unconditional_jumpMethod · 0.80
SomeClass · 0.50
iterMethod · 0.45
truncateMethod · 0.45

Tested by

no test coverage detected