binaryen
binaryen copied to clipboard
Tail-Call optimization
I'm curious as to why binaryen doesn't implement an optimization pass for tailcall feature. Is the optimization itself not feasible?
If it is feasible, I would like to implement it.
The basic idea is we can convert
(func ...
(call $f)
)
to
(func ...
(return_call $f)
)
(func ...
(return (call $f))
)
to
(func ...
(return_call $f)
)
(func ...
(if
(condition)
(call $f)
)
)
to
(func ...
(if
(condition)
(return_call $f)
)
)
Linking to the corresponding PR: https://github.com/WebAssembly/binaryen/pull/7641