Function mz_transform::fold_constants_fixpoint

source ·
pub fn fold_constants_fixpoint() -> Fixpoint
Expand description

Does constant folding to a fixpoint: An expression all of whose leaves are constants, of size small enough to be inlined and folded should reach a single MirRelationExpr::Constant.

This needs to call FoldConstants together with NormalizeLets in a fixpoint loop, because currently FoldConstants doesn’t inline CTEs, so these two need to alternate until fixpoint.

Also note that FoldConstants can break the normalized form by removing all references to a Let.

We also call ReduceScalars, because that does constant folding inside scalar expressions.