[commit: ghc] ghc-7.8: Make SetLevels do substitution properly (fixes Trac #8714) (9a168d6)

git at git.haskell.org git at git.haskell.org
Mon Mar 17 15:36:21 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-7.8
Link       : http://ghc.haskell.org/trac/ghc/changeset/9a168d6097e9d08f4e1d399d10a6690d479e6a40/ghc

>---------------------------------------------------------------

commit 9a168d6097e9d08f4e1d399d10a6690d479e6a40
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Tue Mar 11 11:13:31 2014 +0000

    Make SetLevels do substitution properly (fixes Trac #8714)
    
    Nowadays SetLevels floats case expressions as well as let-bindings,
    and case expressions bind type variables.  We need to clone all such
    floated binders, to avoid accidental name capture.  But I'd forgotten
    to substitute for the cloned type variables, causing #8714.  (In the
    olden days only Ids were cloned, from let-bindings.)
    
    This patch fixes the bug and does quite a bit of clean-up refactoring
    as well, by putting the context level in the LvlEnv.
    
    There is no effect on performance, except that nofib 'rewrite' improves
    allocations by 3%.  On investigation I think it was a fluke to do with
    loop-cutting in big letrec nests.  But at least it's a fluke in the
    right direction.
    
            Program           Size    Allocs   Runtime   Elapsed  TotalMem
    --------------------------------------------------------------------------------
                Min          -0.4%     -3.0%    -19.4%    -19.4%    -26.7%
                Max          -0.0%     +0.0%    +17.9%    +17.9%      0.0%
     Geometric Mean          -0.1%     -0.0%     -0.7%     -0.7%     -0.4%
    
    (cherry picked from commit ef44a429af4a630a153b5774d0e19dbcad8328d5)


>---------------------------------------------------------------

9a168d6097e9d08f4e1d399d10a6690d479e6a40
 compiler/coreSyn/CoreSubst.lhs                    |    2 +-
 compiler/coreSyn/CoreSyn.lhs                      |   21 +-
 compiler/simplCore/SetLevels.lhs                  |  602 ++++++++++-----------
 testsuite/tests/simplCore/should_compile/T8714.hs |    9 +
 testsuite/tests/simplCore/should_compile/all.T    |    1 +
 5 files changed, 312 insertions(+), 323 deletions(-)

Diff suppressed because of size. To see it, use:

    git diff-tree --root --patch-with-stat --no-color --find-copies-harder --ignore-space-at-eol --cc 9a168d6097e9d08f4e1d399d10a6690d479e6a40


More information about the ghc-commits mailing list