Module const_fold

Module const_fold 

Source
Expand description

Constant folding optimization pass for MIR.

Walks basic blocks and evaluates Rvalue::BinaryOp / Rvalue::UnaryOp where both operands are Operand::Constant, replacing with Rvalue::Use(Operand::Constant(...)).

Functionsยง

fold_constants
Run constant folding on a MIR body. Returns the number of folds applied.