Skip to main content

optimize

Function optimize 

Source
pub fn optimize(program: MirProgram) -> MirProgram
Expand description

The canonical Core-MIR optimization pipeline: the passes applied in dependency order (inline → const_fold → algebraic → bool_match → branch_collapse → dead_code → own_param). Every backend that runs the optimizer calls this single entry, so the pass set and their order live in one place instead of being re-nested per call site. lower_program produces the input.

own_param_refine runs LAST: it reads the final slot↔LocalId mapping (after any inlining that mints fresh locals) so its interprocedural Vector/Map-param un-flagging keys off slots that won’t shift under a later pass — avoiding the aliased_slots-vs-LocalId desync class.