egraphs-good / eggcc

MIT License
51 stars 11 forks source link

Function inlining #463

Closed kirstenmg closed 6 months ago

kirstenmg commented 6 months ago

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.

kirstenmg commented 6 months ago

Rewriting this PR to do function inlining in Rust.

kirstenmg commented 6 months ago

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.