[commit: ghc] master: Document determinism in shortOutIndirections (dc94914)
git at git.haskell.org
git at git.haskell.org
Tue May 17 10:37:49 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/dc94914eb0da985a2f006e2bd390fa1fdbafcc33/ghc
>---------------------------------------------------------------
commit dc94914eb0da985a2f006e2bd390fa1fdbafcc33
Author: Bartosz Nitka <niteria at gmail.com>
Date: Tue May 17 02:46:30 2016 -0700
Document determinism in shortOutIndirections
varEnvElts didn't introduce nondeterminism here. This makes it
obvious that it could and explains why it doesn't.
Test Plan: ./validate
Reviewers: bgamari, simonmar, austin, simonpj
Reviewed By: simonpj
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2228
GHC Trac Issues: #4012
>---------------------------------------------------------------
dc94914eb0da985a2f006e2bd390fa1fdbafcc33
compiler/simplCore/SimplCore.hs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs
index 86eadc7..6884696 100644
--- a/compiler/simplCore/SimplCore.hs
+++ b/compiler/simplCore/SimplCore.hs
@@ -51,6 +51,7 @@ import Module
import Maybes
import UniqSupply ( UniqSupply, mkSplitUniqSupply, splitUniqSupply )
+import UniqFM
import Outputable
import Control.Monad
import qualified GHC.LanguageExtensions as LangExt
@@ -901,7 +902,10 @@ shortOutIndirections binds
where
ind_env = makeIndEnv binds
-- These exported Ids are the subjects of the indirection-elimination
- exp_ids = map fst $ varEnvElts ind_env
+ exp_ids = map fst $ nonDetEltsUFM ind_env
+ -- It's OK to use nonDetEltsUFM here because we forget the ordering
+ -- by immediately converting to a set or check if all the elements
+ -- satisfy a predicate.
exp_id_set = mkVarSet exp_ids
no_need_to_flatten = all (null . ruleInfoRules . idSpecialisation) exp_ids
binds' = concatMap zap binds
More information about the ghc-commits
mailing list