Skip to main content

dead

Function dead 

Source
pub fn dead(
    func: &mut Func,
    insts: &BitInsts,
    machine: &MachineInsts,
    names: &Interner,
) -> usize
Expand description

Takes out every conversion whose result nothing reads above the width of its source, and gives back how many.

Each one that goes takes its readers with it: they are pointed at the source instead, which holds the same bits as the result did for as far as anything was looking.

One conversion is one set of changes, which is crate::changes asked the question this pass would otherwise be trusted about. Sending the readers of a register somewhere else and taking the instruction that wrote it out are worth nothing apart, and a reader this missed is a set the framework turns down rather than an instruction taken out from under something still reading it.

Run after lowering and before allocation. Running it once is enough, because the analysis is over the whole function at once and a chain of conversions is settled by the fixpoint rather than by a second run.