Module sway_ir::optimize::simplify_cfg

source ·
Expand description

§Simplify Control Flow Graph

The optimizations here aim to reduce the complexity in control flow by removing basic blocks. This may be done by removing ‘dead’ blocks which are no longer called (or in other words, have no predecessors) or by merging blocks which are linked by a single unconditional branch.

Removing blocks will make the IR neater and more efficient but will also remove indirection of data flow via PHI instructions which in turn can make analyses for passes like constant folding much simpler.

Constants§

Functions§