(inst: &Instruction, rooted: &FxIndexSet<Word>)
| 96 | } |
| 97 | |
| 98 | fn is_rooted(inst: &Instruction, rooted: &FxIndexSet<Word>) -> bool { |
| 99 | if let Some(result_id) = inst.result_id { |
| 100 | rooted.contains(&result_id) |
| 101 | } else { |
| 102 | // For things like OpDecorate which apply attributes to rooted things, but are not |
| 103 | // referenced by roots |
| 104 | inst.operands |
| 105 | .iter() |
| 106 | .any(|op| op.id_ref_any().map_or(false, |w| rooted.contains(&w))) |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | fn kill_unrooted(module: &mut Module, rooted: &FxIndexSet<Word>) { |
| 111 | module |