summaryrefslogtreecommitdiff
path: root/compiler/utils/GraphOps.hs
diff options
context:
space:
mode:
authorBartosz Nitka <niteria@gmail.com>2016-06-06 08:15:43 -0700
committerBartosz Nitka <niteria@gmail.com>2016-06-06 08:21:49 -0700
commit3e7a876a9cdf10e5153421b4905928b9de981778 (patch)
treedd6b7e5ced6f9fd3b1720cbba86b8f47f054d678 /compiler/utils/GraphOps.hs
parent46d2da00ddb8756d966a5ba491b618367911de0f (diff)
downloadhaskell-3e7a876a9cdf10e5153421b4905928b9de981778.tar.gz
Kill foldUniqSet
I planned to just say that we don't care about this part. Turns out I was able to document away the uses in the codegenerator. Test Plan: ./validate Reviewers: simonmar, austin, bgamari Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2307 GHC Trac Issues: #4012
Diffstat (limited to 'compiler/utils/GraphOps.hs')
-rw-r--r--compiler/utils/GraphOps.hs30
1 files changed, 19 insertions, 11 deletions
diff --git a/compiler/utils/GraphOps.hs b/compiler/utils/GraphOps.hs
index ba0db0f9f9..8b194adba5 100644
--- a/compiler/utils/GraphOps.hs
+++ b/compiler/utils/GraphOps.hs
@@ -58,18 +58,24 @@ addNode :: Uniquable k
addNode k node graph
= let
-- add back conflict edges from other nodes to this one
- map_conflict
- = foldUniqSet
- (adjustUFM_C (\n -> n { nodeConflicts = addOneToUniqSet (nodeConflicts n) k}))
- (graphMap graph)
- (nodeConflicts node)
+ map_conflict =
+ nonDetFoldUFM
+ -- It's OK to use nonDetFoldUFM here because the
+ -- operation is commutative
+ (adjustUFM_C (\n -> n { nodeConflicts =
+ addOneToUniqSet (nodeConflicts n) k}))
+ (graphMap graph)
+ (nodeConflicts node)
-- add back coalesce edges from other nodes to this one
- map_coalesce
- = foldUniqSet
- (adjustUFM_C (\n -> n { nodeCoalesce = addOneToUniqSet (nodeCoalesce n) k}))
- map_conflict
- (nodeCoalesce node)
+ map_coalesce =
+ nonDetFoldUFM
+ -- It's OK to use nonDetFoldUFM here because the
+ -- operation is commutative
+ (adjustUFM_C (\n -> n { nodeCoalesce =
+ addOneToUniqSet (nodeCoalesce n) k}))
+ map_conflict
+ (nodeCoalesce node)
in graph
{ graphMap = addToUFM map_coalesce k node}
@@ -462,7 +468,9 @@ freezeNode k
else node -- panic "GraphOps.freezeNode: edge to freeze wasn't in the coalesce set"
-- If the edge isn't actually in the coelesce set then just ignore it.
- fm2 = foldUniqSet (adjustUFM_C (freezeEdge k)) fm1
+ fm2 = nonDetFoldUFM (adjustUFM_C (freezeEdge k)) fm1
+ -- It's OK to use nonDetFoldUFM here because the operation
+ -- is commutative
$ nodeCoalesce node
in fm2