[commit: ghc] wip/ghc-8.0-det: Remove some varSetElems in dsCmdStmt (85f42e8)
git at git.haskell.org
git at git.haskell.org
Mon Jul 18 17:58:05 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/ghc-8.0-det
Link : http://ghc.haskell.org/trac/ghc/changeset/85f42e89c2911ebeeb12401014ad5f852860150e/ghc
>---------------------------------------------------------------
commit 85f42e89c2911ebeeb12401014ad5f852860150e
Author: Bartosz Nitka <niteria at gmail.com>
Date: Wed May 11 07:47:15 2016 -0700
Remove some varSetElems in dsCmdStmt
varSetElems introduces unnecessary determinism and it's easy to
preserve determinism here.
Test Plan: ./validate
Reviewers: goldfire, simonmar, austin, bgamari, simonpj
Reviewed By: simonpj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2195
GHC Trac Issues: #4012
>---------------------------------------------------------------
85f42e89c2911ebeeb12401014ad5f852860150e
compiler/deSugar/DsArrows.hs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/compiler/deSugar/DsArrows.hs b/compiler/deSugar/DsArrows.hs
index ea10b74..cdf839a 100644
--- a/compiler/deSugar/DsArrows.hs
+++ b/compiler/deSugar/DsArrows.hs
@@ -48,6 +48,7 @@ import VarSet
import SrcLoc
import ListSetOps( assocDefault )
import Data.List
+import Util
data DsCmdEnv = DsCmdEnv {
arr_id, compose_id, first_id, app_id, choice_id, loop_id :: CoreExpr
@@ -786,7 +787,7 @@ dsCmdStmt ids local_vars out_ids (BindStmt pat cmd _ _ _) env_ids = do
(core_cmd, fv_cmd, env_ids1) <- dsfixCmd ids local_vars unitTy pat_ty cmd
let pat_vars = mkVarSet (collectPatBinders pat)
let
- env_ids2 = varSetElems (mkVarSet out_ids `minusVarSet` pat_vars)
+ env_ids2 = filterOut (`elemVarSet` pat_vars) out_ids
env_ty2 = mkBigCoreVarTupTy env_ids2
-- multiplexing function
@@ -863,8 +864,9 @@ dsCmdStmt ids local_vars out_ids
, recS_later_rets = later_rets, recS_rec_rets = rec_rets })
env_ids = do
let
- env2_id_set = mkVarSet out_ids `minusVarSet` mkVarSet later_ids
- env2_ids = varSetElems env2_id_set
+ later_ids_set = mkVarSet later_ids
+ env2_ids = filterOut (`elemVarSet` later_ids_set) out_ids
+ env2_id_set = mkVarSet env2_ids
env2_ty = mkBigCoreVarTupTy env2_ids
-- post_loop_fn = \((later_ids),(env2_ids)) -> (out_ids)
More information about the ghc-commits
mailing list