sway_ir::optimize

Module dce

Source
Expand description

§Dead Code Elimination

This optimization removes unused definitions. The pass is a combination of:

  1. A liveness analysis that keeps track of the uses of a definition,
  2. At the time of inspecting a definition, if it has no uses, it is removed.

This pass does not do CFG transformations. That is handled by simplify_cfg.

Constants§

DCE_NAME
FN_DCE_NAME

Functions§

create_dce_pass
create_fn_dce_pass
dce
Perform dead code (if any) elimination and return true if the function is modified.
fn_dce
Remove entire functions from a module based on whether they are called or not, using a list of root ‘entry’ functions to perform a search.