(module: &mut Module, rooted: &FxIndexSet<Word>)
| 108 | } |
| 109 | |
| 110 | fn kill_unrooted(module: &mut Module, rooted: &FxIndexSet<Word>) { |
| 111 | module |
| 112 | .ext_inst_imports |
| 113 | .retain(|inst| is_rooted(inst, rooted)); |
| 114 | module |
| 115 | .execution_modes |
| 116 | .retain(|inst| is_rooted(inst, rooted)); |
| 117 | module |
| 118 | .debug_string_source |
| 119 | .retain(|inst| is_rooted(inst, rooted)); |
| 120 | module.debug_names.retain(|inst| is_rooted(inst, rooted)); |
| 121 | module |
| 122 | .debug_module_processed |
| 123 | .retain(|inst| is_rooted(inst, rooted)); |
| 124 | module.annotations.retain(|inst| is_rooted(inst, rooted)); |
| 125 | module |
| 126 | .types_global_values |
| 127 | .retain(|inst| is_rooted(inst, rooted)); |
| 128 | module |
| 129 | .functions |
| 130 | .retain(|f| is_rooted(f.def.as_ref().unwrap(), rooted)); |
| 131 | for fun in &mut module.functions { |
| 132 | for block in &mut fun.blocks { |
| 133 | block |
| 134 | .instructions |
| 135 | .retain(|inst| !instruction_is_pure(inst) || is_rooted(inst, rooted)); |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | pub fn dce_phi(func: &mut Function) { |
| 141 | let mut used = FxIndexSet::default(); |
no test coverage detected