[commit: ghc] wip/ghc-8.0-det: Kill some unnecessary varSetElems (af1fe61)
git at git.haskell.org
git at git.haskell.org
Thu Jul 14 13:53:03 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/ghc-8.0-det
Link : http://ghc.haskell.org/trac/ghc/changeset/af1fe61fb452f784a565efe267a8fa23a70034cb/ghc
>---------------------------------------------------------------
commit af1fe61fb452f784a565efe267a8fa23a70034cb
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
>---------------------------------------------------------------
af1fe61fb452f784a565efe267a8fa23a70034cb
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 af1fe61fb452f784a565efe267a8fa23a70034cb
More information about the ghc-commits
mailing list