Skip to content

Late lambda lifting for free variables shared inside recursive groups.

This is mostly a question for @sgraf812 but seems fitting here as others might have opinions/knowledge on this as well.

The basic scenario is that we have something like:

Rec {
  foo {fv1,fvs_foo} args = ... foo args ... bar args  ...
  bar {fv1,fvs_bar} args = ... foo args ... bar args ...
} in 
...
let my_fav_thk {fv1} = ... foo args ...

Does late lambda lifting currently support transforming this into something like:

Rec {
  foo {fvs_foo} fv1 args = ... foo fv1 args ... bar fv1 args ...
  bar {fvs_bar} fv1 args = ... foo fv1 args ... bar fv1 args ...
} in 
... 
let my_fav_thk {fv1} = ... foo fv1 args ...

I'm currently looking at a codebase where we could save a lot of memory this way. But it doesn't seem to happen and I found no obvious knob to make it happen.

Edited by Andreas Klebinger
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information