pub fn memoize_for_explicit_lowering<'a>(
stmts: Vec<Stmt<'a>>,
expr_arena: &'a Arena<Expr<'a>>,
stmt_arena: &'a Arena<Stmt<'a>>,
interner: &mut Interner,
cfg: &OptimizationConfig,
) -> Vec<Stmt<'a>>Expand description
The AOT optimizer — ONE pipeline. The Futamura residual (fold, propagate,
polyvariant PE, CTFE) then the ARCHITECT: equality saturation over a
kernel-certified e-graph, Oracle facts gating the conditional rewrites
(value facts suppressed for loop-mutated variables — see egraph::convert);
then defunctionalization, deforestation, interval analysis, DCE, and
supercompilation. GVN/LICM/closed-form STILL run after the e-graph until it
subsumes their cross-statement and loop-recurrence reach (the EG waves).
Memoize the pure single-argument self-recursive functions of an already-optimized program for a
lowering that has no native memoization construct. Rust emits its own cache during codegen; direct C
and bytecode-derived backends instead consume this explicit Map-based residual. Keeping the transform
here makes Memo one optimization with one eligibility rule and firing trace across those backends.