[commit: ghc] master: Kill some unnecessary varSetElems (928d747)

git at git.haskell.org git at git.haskell.org
Fri Apr 15 11:45:07 UTC 2016


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/928d74733975fe4677e2b558d031779f58a0883c/ghc

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

commit 928d74733975fe4677e2b558d031779f58a0883c
Author: Bartosz Nitka <niteria at gmail.com>
Date:   Fri Apr 15 04:46:21 2016 -0700

    Kill some unnecessary varSetElems
    
    When you do `varSetElems (tyCoVarsOfType x)` it's equivalent to
    `tyCoVarsOfTypeList x`.
    
    Why? If you look at the implementation:
    ```
    tyCoVarsOfTypeList ty = runFVList $ tyCoVarsOfTypeAcc ty
    tyCoVarsOfType ty = runFVSet $ tyCoVarsOfTypeAcc ty
    ```
    they use the same helper function. The helper function returns a
    deterministically ordered list and a set. The only difference
    between the two is which part of the result they take. It is redundant
    to take the set and then immediately convert it to a list.
    
    This helps with determinism and we eventually want to replace the uses
    of `varSetElems` with functions that don't leak the values of uniques.
    This change gets rid of some instances that are easy to kill.
    
    I chose not to annotate every place where I got rid of `varSetElems`
    with a comment about non-determinism, because once we get rid of
    `varSetElems` it will not be possible to do the wrong thing.
    
    Test Plan: ./validate
    
    Reviewers: goldfire, austin, simonmar, bgamari, simonpj
    
    Reviewed By: simonpj
    
    Subscribers: thomie
    
    Differential Revision: https://phabricator.haskell.org/D2115
    
    GHC Trac Issues: #4012


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

928d74733975fe4677e2b558d031779f58a0883c
 compiler/coreSyn/CoreFVs.hs      | 40 ++++++++++++++++++++++++++++++++++++----
 compiler/coreSyn/CoreLint.hs     |  4 ++--
 compiler/deSugar/Desugar.hs      |  6 ++++--
 compiler/deSugar/DsArrows.hs     |  2 +-
 compiler/deSugar/DsBinds.hs      |  4 +++-
 compiler/main/InteractiveEval.hs |  7 +++----
 compiler/main/TidyPgm.hs         |  2 +-
 compiler/specialise/Rules.hs     |  4 ++--
 compiler/typecheck/TcErrors.hs   |  2 +-
 compiler/typecheck/TcInteract.hs |  2 +-
 compiler/typecheck/TcSimplify.hs |  5 +++--
 compiler/typecheck/TcTyDecls.hs  |  4 ++--
 compiler/typecheck/TcValidity.hs |  5 +++--
 13 files changed, 62 insertions(+), 25 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 928d74733975fe4677e2b558d031779f58a0883c


More information about the ghc-commits mailing list