Make let-floating work even if there are big lambdas in the way
authorsimonpj@microsoft.com <unknown>
Mon, 7 May 2007 16:24:22 +0000 (16:24 +0000)
committersimonpj@microsoft.com <unknown>
Mon, 7 May 2007 16:24:22 +0000 (16:24 +0000)
commit3ceff7a48281bfb6145abb174ad5a46e59f83909
treefbde47db858b34a91fa6c92f2d22f617097dec06
parentd914b83e6b1baafc8d830eff1aedbe55d25d84cc
Make let-floating work even if there are big lambdas in the way

This patch generalises the let-floating transformation in a way
suggested by Roman and Manuel when doing closure conversion.

There are extensive comments in Note [Floating and type abstraction],
which begins thus.  Consider this:
x = /\a. C e1 e2
We'd like to float this to
y1 = /\a. e1
y2 = /\a. e2
x = /\a. C (y1 a) (y2 a)
for the usual reasons: we want to inline x rather vigorously.

(Further commennts follow in SimplUtils.)

The implementation is not hard; indeed it used to be in GHC years ago.
I removed it thinking that full laziness would achieve the same
effect, but I'm not sure it does; and in any case it seems more direct
to do it here.

The transformation should not make anything worse, so yell if
you see anything unexpected happening.
compiler/simplCore/SimplEnv.lhs
compiler/simplCore/SimplUtils.lhs
compiler/simplCore/Simplify.lhs