[GHC] #9476: Implement late lambda-lifting
GHC
ghc-devs at haskell.org
Fri Oct 19 16:56:24 UTC 2018
#9476: Implement late lambda-lifting
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: sgraf
Type: feature request | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.2
Resolution: | Keywords: LateLamLift
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: #8763 #13286 | Differential Rev(s): Phab:D5224
Wiki Page: LateLamLift |
-------------------------------------+-------------------------------------
Comment (by sgraf):
Nevermind, the regression was due to lifting binders occuring in a nullary
applications. Example from `CS`:
{{{
main_$s$wgo =
\r [sc sc1]
case sc1 of wild {
__DEFAULT ->
let {
lvl =
\u []
case -# [wild 1#] of sat { __DEFAULT ->
main_$s$wgo sc sat; }; } in
let {
sat =
\r [s1] case plusInteger s1 ds of s' { __DEFAULT ->
lvl s'; };
} in sat;
0# -> sc ();
};
==>
main_$s$wgo =
\r [sc sc1]
case sc1 of wild {
__DEFAULT ->
let {
lvl =
\u []
case -# [wild 1#] of sat { __DEFAULT ->
main_$s$wgo sc sat; };
} in $lsat lvl;
0# -> sc ();
};
$lsat =
\r [lvl s1] case plusInteger s1 ds of s' { __DEFAULT -> lvl s'; };
}}}
(`main_$s$wgo` is a ternary function)
This is a beneficial lift from the perspective of closure growth, but
actually allocates more because the nullary application `sat` turns into a
partial application `$lsat lvl` which allocates.
Fixing this by regarding nullary applications as argument occurrences of
the binder (e.g. a no-go) has the same effect to nofib benchmarks as just
disallowing ''any'' undersaturated calls to the binder to lift. The latter
is much simpler to check for (just look at the `StgBinderInfo` of the RHS)
and is the status quo in Phab:D5224. So, no news, basically.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9476#comment:47>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list