Implement escape analysis for stack allocation.
Motivation
Reduce GC pressure.
Proposal
Figure out if a function stores (parts of) it's arguments in it's return value.
With this information we can look at let bindings. Any binding which is only used as non-escaping argument can then be allocated on the stack instead and implicitly freed on return.
This is fairly well understood and should mostly carry over to Haskell. The benefits might be different due to the lazy nature of Haskell though.
Edited by Andreas Klebinger