summaryrefslogtreecommitdiff
path: root/compiler/cmm/CmmCommonBlockElim.hs
diff options
context:
space:
mode:
authorBartosz Nitka <niteria@gmail.com>2016-06-29 07:34:55 -0700
committerBartosz Nitka <niteria@gmail.com>2016-06-30 05:55:51 -0700
commitfb6e2c7fe213004c7398a13e3cc38d4428b66b12 (patch)
tree0bd461ec64d6eddb87ec40f0d01735ba5fbac85a /compiler/cmm/CmmCommonBlockElim.hs
parente8d62711e6cbc3065ee5e6f6a654667f02a0bcd1 (diff)
downloadhaskell-fb6e2c7fe213004c7398a13e3cc38d4428b66b12.tar.gz
Delete Ord Unique
Ord Unique can be a source of invisible, accidental nondeterminism as explained in Note [No Ord for Unique]. This removes it, leaving a note with rationale. It's unfortunate that I had to write Ord instances for codegen data structures by hand, but I believe that it's a right trade-off here. Test Plan: ./validate Reviewers: simonmar, austin, bgamari Reviewed By: simonmar Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D2370 GHC Trac Issues: #4012
Diffstat (limited to 'compiler/cmm/CmmCommonBlockElim.hs')
-rw-r--r--compiler/cmm/CmmCommonBlockElim.hs8
1 files changed, 5 insertions, 3 deletions
diff --git a/compiler/cmm/CmmCommonBlockElim.hs b/compiler/cmm/CmmCommonBlockElim.hs
index 6c4742edad..3217c9394a 100644
--- a/compiler/cmm/CmmCommonBlockElim.hs
+++ b/compiler/cmm/CmmCommonBlockElim.hs
@@ -21,6 +21,8 @@ import Data.Word
import qualified Data.Map as M
import Outputable
import UniqFM
+import UniqDFM
+import qualified TrieMap as TM
import Unique
import Control.Arrow (first, second)
@@ -285,10 +287,10 @@ copyTicks env g
-- Group by [Label]
groupByLabel :: [(Key, a)] -> [(Key, [a])]
-groupByLabel = go M.empty
+groupByLabel = go (TM.emptyTM :: TM.ListMap UniqDFM a)
where
- go !m [] = M.elems m
- go !m ((k,v) : entries) = go (M.alter adjust k' m) entries
+ go !m [] = TM.foldTM (:) m []
+ go !m ((k,v) : entries) = go (TM.alterTM k' adjust m) entries
where k' = map getUnique k
adjust Nothing = Just (k,[v])
adjust (Just (_,vs)) = Just (k,v:vs)