Closed kirstenmg closed 6 months ago
Rewriting this PR to do function inlining in Rust.
Function inlining only runs for 2 iterations right now (see #494 ), so some bril programs, like simple_recursive.bril
, do not have their calls optimized away.
Implementation of function inlining for DAG-in-context. I had to carefully manipulate the schedule to make substitution go deep enough without continuing forever on infinitely recursive functions. This is bad, and things may get too slow again once other optimizations are in. However, I don't know what alternative there is other than adding phi nodes.
Note that the majority of
function_inlining.egg
is a copy-pasted Subst, renamed to FunctionInliningSubst. The actual inlining rule is at the end, since it uses FunctionInliningSubst.