1 use rustc_index::bit_set::BitSet;
2 use rustc_middle::mir::{self, Local};
4 /// The set of locals in a MIR body that do not have `StorageLive`/`StorageDead` annotations.
6 /// These locals have fixed storage for the duration of the body.
7 pub fn always_storage_live_locals(body: &mir::Body<'_>) -> BitSet<Local> {
8 let mut always_live_locals = BitSet::new_filled(body.local_decls.len());
10 for block in &*body.basic_blocks {
11 for statement in &block.statements {
12 use mir::StatementKind::{StorageDead, StorageLive};
13 if let StorageLive(l) | StorageDead(l) = statement.kind {
14 always_live_locals.remove(l);