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§

Functions§

  • Perform dead code (if any) elimination and return true if the function is modified.
  • 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.