[commit: ghc] wip/T14152: simplNonRecJoinPoint: Handle Shadowing correctly (31b7d33)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 13:33:07 UTC 2017


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

On branch  : wip/T14152
Link       : http://ghc.haskell.org/trac/ghc/changeset/31b7d33c898e81088e7a897f4e33eeb8da665a7e/ghc

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

commit 31b7d33c898e81088e7a897f4e33eeb8da665a7e
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Thu Oct 26 19:36:24 2017 -0400

    simplNonRecJoinPoint: Handle Shadowing correctly
    
    Previously, (since 33452df), simplNonRecJoinPoint would do the wrong
    thing in the presence of shadowing: It analyzed the RHS of a join
    binding with the environment for the body. In particular, with
    
        foo x =
          join x = x * x
          in x
    
    where there is shadowing, it renames the inner x to x1, and should
    produce
    
        foo x =
          join x1 = x * x
          in x1
    
    but because the substitution (x ↦ x1) is also used on the RHS we get the
    bogus
    
        foo x =
          join x1 = x1 * x1
          in x1
    
    The corresponding function for non-join-points, i.e. simplNonRecE, does
    the right thing and has done so forever, so I’ll skip creating a test
    case or a note for this.
    
    Differential Revision: https://phabricator.haskell.org/D4130


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

31b7d33c898e81088e7a897f4e33eeb8da665a7e
 compiler/basicTypes/Id.hs                          |   6 +-
 compiler/basicTypes/Unique.hs                      |   4 +
 compiler/coreSyn/CoreLint.hs                       |   1 +
 compiler/coreSyn/CoreSyn.hs                        |  10 +-
 compiler/ghc.cabal.in                              |   1 +
 compiler/main/DynFlags.hs                          |   6 +
 compiler/simplCore/CoreMonad.hs                    |   2 +
 compiler/simplCore/Exitify.hs                      | 442 +++++++++++++++++++++
 compiler/simplCore/SimplCore.hs                    |   8 +
 compiler/simplCore/SimplUtils.hs                   |   1 +
 compiler/simplCore/Simplify.hs                     |  13 +-
 docs/users_guide/using-optimisation.rst            |  10 +
 testsuite/tests/simplCore/should_compile/T14152.hs |  23 ++
 .../tests/simplCore/should_compile/T14152.stderr   | 129 ++++++
 .../tests/simplCore/should_compile/T14152a.hs      |   1 +
 .../tests/simplCore/should_compile/T14152a.stderr  | 222 +++++++++++
 testsuite/tests/simplCore/should_compile/all.T     |   2 +
 17 files changed, 870 insertions(+), 11 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 31b7d33c898e81088e7a897f4e33eeb8da665a7e


More information about the ghc-commits mailing list