Skip to main content

Module dead_code

Module dead_code 

Source
Expand description

Phase 6 wave 6 — dead-code elimination on MIR.

Drop Let { binding, value: <pure>, body } when binding is never read in body. Pure = no observable side effect: Literal / Local / BinOp / Neg / Tuple / List / MapLiteral (with pure entries) / Project / Construct / RecordCreate / RecordUpdate (with pure subtrees). Call / TailCall / Try / Return / Match / InterpolatedStr / IndependentProduct are conservatively impure.

Const-fold runs before DCE so any folded sub-arithmetic collapses to a Literal (pure) and unlocks its enclosing Let for elimination.

Functions§

dead_code