(&mut self, mut func: Function)
| 125 | } |
| 126 | |
| 127 | fn mutate(&mut self, mut func: Function) -> Option<(Function, String, ProgressStatus)> { |
| 128 | next_inst_ret_prev(&func, &mut self.block, &mut self.inst).map(|(prev_block, prev_inst)| { |
| 129 | func.layout.remove_inst(prev_inst); |
| 130 | let msg = if func.layout.block_insts(prev_block).next().is_none() { |
| 131 | // Make sure empty blocks are removed, as `next_inst_ret_prev` depends on non empty blocks |
| 132 | func.layout.remove_block(prev_block); |
| 133 | format!("Remove inst {prev_inst} and empty block {prev_block}") |
| 134 | } else { |
| 135 | format!("Remove inst {prev_inst}") |
| 136 | }; |
| 137 | (func, msg, ProgressStatus::ExpandedOrShrinked) |
| 138 | }) |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | /// Try to replace instructions with `iconst` or `fconst`. |
no test coverage detected