Skip to main content

Module liveness

Module liveness 

Source
Expand description

Liveness analysis on MIR.

Determines which variables are live (will be used later) at each program point. This is the foundation for smart move/clone inference:

  • If a variable is NOT live after an assignment, it can be moved (zero cost).
  • If a variable IS live after an assignment, it must be cloned (requires Clone).

Structs§

LivenessResult
Result of liveness analysis for a MIR function.

Functions§

compute_liveness
Run liveness analysis on a MIR function. Uses the standard backward dataflow algorithm: live_out[B] = ∪ live_in[S] for all successors S of B live_in[B] = (live_out[B] - def[B]) ∪ use[B]