summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Nitka <niteria@gmail.com>2016-05-17 02:46:30 -0700
committerBartosz Nitka <niteria@gmail.com>2016-05-17 03:40:58 -0700
commitdc94914eb0da985a2f006e2bd390fa1fdbafcc33 (patch)
treea12af48f66de26433c2446bbffa7088f3a1fe3a6
parent770d7085d6e3f3e74e3ffe318aeaf135cf3aea72 (diff)
downloadhaskell-dc94914eb0da985a2f006e2bd390fa1fdbafcc33.tar.gz
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
-rw-r--r--compiler/simplCore/SimplCore.hs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/simplCore/SimplCore.hs b/compiler/simplCore/SimplCore.hs
index 86eadc7a37..6884696c97 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