diff options
author | Bartosz Nitka <niteria@gmail.com> | 2016-07-01 06:50:55 -0700 |
---|---|---|
committer | Bartosz Nitka <niteria@gmail.com> | 2016-07-01 08:26:01 -0700 |
commit | 0ab63cf48580abbfe15ece934aec093203f29ed2 (patch) | |
tree | 1959d3808a4c1ffe3dfab003ccef26be394964f0 | |
parent | 0d522b80bc9d3cfc2b23a3a4d9092e08f006054e (diff) | |
download | haskell-0ab63cf48580abbfe15ece934aec093203f29ed2.tar.gz |
Kill varEnvElts in seqDmdEnv
GHC Trac: #4012
-rw-r--r-- | compiler/basicTypes/Demand.hs | 3 | ||||
-rw-r--r-- | compiler/utils/UniqFM.hs | 8 |
2 files changed, 8 insertions, 3 deletions
diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs index 9165782117..8dc7f3b895 100644 --- a/compiler/basicTypes/Demand.hs +++ b/compiler/basicTypes/Demand.hs @@ -1306,8 +1306,7 @@ seqDmdType (DmdType env ds res) = seqDmdEnv env `seq` seqDemandList ds `seq` seqDmdResult res `seq` () seqDmdEnv :: DmdEnv -> () -seqDmdEnv env = seqDemandList (varEnvElts env) - +seqDmdEnv env = seqEltsUFM seqDemandList env splitDmdTy :: DmdType -> (Demand, DmdType) -- Split off one function argument diff --git a/compiler/utils/UniqFM.hs b/compiler/utils/UniqFM.hs index 261dd1c622..bb9d95c93a 100644 --- a/compiler/utils/UniqFM.hs +++ b/compiler/utils/UniqFM.hs @@ -54,7 +54,7 @@ module UniqFM ( intersectUFM_C, disjointUFM, nonDetFoldUFM, foldUFM, nonDetFoldUFM_Directly, - anyUFM, allUFM, + anyUFM, allUFM, seqEltsUFM, mapUFM, mapUFM_Directly, elemUFM, elemUFM_Directly, filterUFM, filterUFM_Directly, partitionUFM, @@ -292,6 +292,12 @@ anyUFM p (UFM m) = M.fold ((||) . p) False m allUFM :: (elt -> Bool) -> UniqFM elt -> Bool allUFM p (UFM m) = M.fold ((&&) . p) True m +seqEltsUFM :: ([elt] -> ()) -> UniqFM elt -> () +seqEltsUFM seqList = seqList . nonDetEltsUFM + -- It's OK to use nonDetEltsUFM here because the type guarantees that + -- the only interesting thing this function can do is to force the + -- elements. + -- See Note [Deterministic UniqFM] to learn about nondeterminism. -- If you use this please provide a justification why it doesn't introduce -- nondeterminism. |