[Git][ghc/ghc][wip/romes/deterministic-label-map] 2 commits: Introduce back LabelMap non deterministic

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Thu Jul 11 10:26:32 UTC 2024



Rodrigo Mesquita pushed to branch wip/romes/deterministic-label-map at Glasgow Haskell Compiler / GHC


Commits:
875be730 by Rodrigo Mesquita at 2024-07-11T11:24:37+01:00
Introduce back LabelMap non deterministic

- - - - -
89ffb186 by Rodrigo Mesquita at 2024-07-11T11:26:05+01:00
Use NonDeterministic Label map in multiple passes

(TODO: More could be available. Look through Det LabelMap uses again)

- - - - -


29 changed files:

- compiler/GHC/Cmm/Dataflow.hs
- compiler/GHC/Cmm/Dataflow/Label.hs
- + compiler/GHC/Cmm/Dataflow/Label/NonDet.hs
- compiler/GHC/Cmm/Graph.hs
- compiler/GHC/Cmm/Info/Build.hs
- compiler/GHC/Cmm/LayoutStack.hs
- compiler/GHC/Cmm/Lint.hs
- compiler/GHC/Cmm/Liveness.hs
- compiler/GHC/Cmm/Pipeline.hs
- compiler/GHC/Cmm/ProcPoint.hs
- compiler/GHC/Cmm/Sink.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/BlockLayout.hs
- compiler/GHC/CmmToAsm/PIC.hs
- compiler/GHC/CmmToAsm/Reg/Graph/Spill.hs
- compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs
- compiler/GHC/CmmToAsm/Reg/Graph/SpillCost.hs
- compiler/GHC/CmmToAsm/Reg/Linear.hs
- compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs
- compiler/GHC/CmmToAsm/Reg/Liveness.hs
- compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/CmmToLlvm/CodeGen.hs
- compiler/GHC/Data/Graph/Collapse.hs
- compiler/GHC/StgToCmm/Heap.hs
- compiler/GHC/StgToCmm/Monad.hs
- compiler/GHC/Types/Unique/DFM.hs
- compiler/ghc.cabal.in


Changes:

=====================================
compiler/GHC/Cmm/Dataflow.hs
=====================================
@@ -43,7 +43,9 @@ import Data.Kind (Type)
 
 import GHC.Cmm.Dataflow.Block
 import GHC.Cmm.Dataflow.Graph
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (LabelMap)
+import qualified GHC.Cmm.Dataflow.Label as Det
+import GHC.Cmm.Dataflow.Label.NonDet hiding (LabelMap)
 
 type family   Fact (x :: Extensibility) f :: Type
 type instance Fact C f = FactBase f
@@ -156,7 +158,7 @@ fixpointAnalysis direction lattice do_block entry blockmap = loop start
             -- information in fbase1 and (if something changed) we update it
             -- and add the affected blocks to the worklist.
             (todo2, fbase2) = {-# SCC "mapFoldWithKey" #-}
-                mapFoldlWithKey
+                nonDetMapFoldlWithKey
                     (updateFact join dep_blocks) (todo1, fbase1) out_facts
         in loop todo2 fbase2
     loop _ !fbase1 = fbase1
@@ -227,9 +229,9 @@ fixpointRewrite dir lattice do_block entry blockmap = loop start blockmap
         let block = block_arr ! index
         (new_block, out_facts) <- {-# SCC "do_block_rewrite" #-}
             do_block block fbase1
-        let blocks2 = mapInsert (entryLabel new_block) new_block blocks1
+        let blocks2 = Det.mapInsert (entryLabel new_block) new_block blocks1
             (todo2, fbase2) = {-# SCC "mapFoldWithKey_rewrite" #-}
-                mapFoldlWithKey
+                nonDetMapFoldlWithKey
                     (updateFact join dep_blocks) (todo1, fbase1) out_facts
         loop todo2 blocks2 fbase2
     loop _ !blocks1 !fbase1 = return (blocks1, fbase1)
@@ -320,16 +322,16 @@ sortBlocks direction entry blockmap =
 -- * for a forward analysis, we only need to re-analyze the current block
 --   (and that will in turn propagate facts into its successors).
 mkDepBlocks :: NonLocal node => Direction -> [Block node C C] -> LabelMap IntSet
-mkDepBlocks Fwd blocks = go blocks 0 mapEmpty
+mkDepBlocks Fwd blocks = go blocks 0 Det.mapEmpty
   where
     go []     !_ !dep_map = dep_map
     go (b:bs) !n !dep_map =
-        go bs (n + 1) $ mapInsert (entryLabel b) (IntSet.singleton n) dep_map
-mkDepBlocks Bwd blocks = go blocks 0 mapEmpty
+        go bs (n + 1) $ Det.mapInsert (entryLabel b) (IntSet.singleton n) dep_map
+mkDepBlocks Bwd blocks = go blocks 0 Det.mapEmpty
   where
     go []     !_ !dep_map = dep_map
     go (b:bs) !n !dep_map =
-        let insert m l = mapInsertWith IntSet.union l (IntSet.singleton n) m
+        let insert m l = Det.mapInsertWith IntSet.union l (IntSet.singleton n) m
         in go bs (n + 1) $ foldl' insert dep_map (successors b)
 
 -- | After some new facts have been generated by analysing a block, we
@@ -353,7 +355,7 @@ updateFact fact_join dep_blocks (todo, fbase) lbl new_fact
               (Changed f) -> let !z = mapInsert lbl f fbase in (changed, z)
   where
     changed = todo `IntSet.union`
-              mapFindWithDefault IntSet.empty lbl dep_blocks
+              Det.mapFindWithDefault IntSet.empty lbl dep_blocks
 
 {-
 Note [No old fact]


=====================================
compiler/GHC/Cmm/Dataflow/Label.hs
=====================================
@@ -7,11 +7,9 @@
 {-# OPTIONS_GHC -Wno-unused-top-binds #-}
 
 module GHC.Cmm.Dataflow.Label
-    ( Label
+    ( Label(..)
     , LabelMap
     , LabelSet
-    , FactBase
-    , lookupFact
     , mkHooplLabel
     -- * Set
     , setEmpty
@@ -295,10 +293,3 @@ instance TrieMap LabelMap where
   foldTM k m z  = mapFoldr k z m
   filterTM f m  = mapFilter f m
 
------------------------------------------------------------------------------
--- FactBase
-
-type FactBase f = LabelMap f
-
-lookupFact :: Label -> FactBase f -> Maybe f
-lookupFact = mapLookup


=====================================
compiler/GHC/Cmm/Dataflow/Label/NonDet.hs
=====================================
@@ -0,0 +1,297 @@
+{-# LANGUAGE DeriveTraversable  #-}
+{-# LANGUAGE DerivingStrategies #-}
+{-# LANGUAGE FlexibleInstances  #-}
+{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE MultiParamTypeClasses #-}
+{-# LANGUAGE TypeFamilies #-}
+{-# OPTIONS_GHC -Wno-unused-top-binds #-}
+
+-- | Non-deterministic 'LabelMap' and 'LabelSet':
+--
+-- Labels that use non-deterministic Uniques will make this map
+-- non-deterministic. In contrast, 'GHC.Cmm.Dataflow.Label.LabelMap' will be
+-- deterministically ordered regardless of the non-deterministic origin of the
+-- Uniques in the labels.
+--
+-- We want to make sure that non-deterministic label maps are only used when
+-- the non-determinism of the map cannot affect the determinism of the code
+-- generation output. To that effect, this label map only exposes operations
+-- which don't allow non-determinism from the outside, e.g., it exposes maps
+-- and lookups, but not traversals or to-list functions.
+module GHC.Cmm.Dataflow.Label.NonDet
+    ( Label
+    , LabelMap
+    , LabelSet
+    , FactBase
+    , lookupFact
+    , mkHooplLabel
+    -- * Set
+    , setEmpty
+    , setNull
+    , setSize
+    , setMember
+    , setSingleton
+    , setInsert
+    , setDelete
+    , setUnion
+    , setUnions
+    , setDifference
+    , setIntersection
+    , setIsSubsetOf
+    , setFilter
+    , setFromList
+    , nonDetSetFoldl
+    , nonDetSetFoldr
+    , nonDetSetElems
+    -- * Map
+    , mapNull
+    , mapSize
+    , mapMember
+    , mapLookup
+    , mapFindWithDefault
+    , mapEmpty
+    , mapSingleton
+    , mapInsert
+    , mapInsertWith
+    , mapDelete
+    , mapAlter
+    , mapAdjust
+    , mapUnion
+    , mapUnions
+    , mapUnionWithKey
+    , mapDifference
+    , mapIntersection
+    , mapIsSubmapOf
+    , mapMap
+    , mapMapWithKey
+    , mapFilter
+    , mapFilterWithKey
+    , mapFromList
+    , mapFromListWith
+    , nonDetMapElems
+    , nonDetMapFoldl
+    , nonDetMapFoldr
+    , nonDetMapFoldlWithKey
+    , nonDetMapFoldMapWithKey
+    , nonDetMapKeys
+    , nonDetMapToList
+    ) where
+
+import GHC.Prelude
+
+import GHC.Utils.Outputable
+
+-- The code generator will eventually be using all the labels stored in a
+-- LabelSet and LabelMap. For these reasons we use the strict variants of these
+-- data structures. We inline selectively to enable the RULES in Word64Map/Set
+-- to fire.
+import GHC.Data.Word64Set (Word64Set)
+import qualified GHC.Data.Word64Set as S
+import GHC.Data.Word64Map.Strict (Word64Map)
+import qualified GHC.Data.Word64Map.Strict as M
+
+import Data.List (foldl1')
+
+import GHC.Cmm.Dataflow.Label (Label(..), mkHooplLabel)
+
+-----------------------------------------------------------------------------
+-- LabelSet
+
+newtype LabelSet = LS Word64Set
+  deriving newtype (Eq, Ord, Show, Monoid, Semigroup)
+
+setNull :: LabelSet -> Bool
+setNull (LS s) = S.null s
+
+setSize :: LabelSet -> Int
+setSize (LS s) = S.size s
+
+setMember :: Label -> LabelSet -> Bool
+setMember (Label k) (LS s) = S.member k s
+
+setEmpty :: LabelSet
+setEmpty = LS S.empty
+
+setSingleton :: Label -> LabelSet
+setSingleton (Label k) = LS (S.singleton k)
+
+setInsert :: Label -> LabelSet -> LabelSet
+setInsert (Label k) (LS s) = LS (S.insert k s)
+
+setDelete :: Label -> LabelSet -> LabelSet
+setDelete (Label k) (LS s) = LS (S.delete k s)
+
+setUnion :: LabelSet -> LabelSet -> LabelSet
+setUnion (LS x) (LS y) = LS (S.union x y)
+
+{-# INLINE setUnions #-}
+setUnions :: [LabelSet] -> LabelSet
+setUnions [] = setEmpty
+setUnions sets = foldl1' setUnion sets
+
+setDifference :: LabelSet -> LabelSet -> LabelSet
+setDifference (LS x) (LS y) = LS (S.difference x y)
+
+setIntersection :: LabelSet -> LabelSet -> LabelSet
+setIntersection (LS x) (LS y) = LS (S.intersection x y)
+
+setIsSubsetOf :: LabelSet -> LabelSet -> Bool
+setIsSubsetOf (LS x) (LS y) = S.isSubsetOf x y
+
+setFilter :: (Label -> Bool) -> LabelSet -> LabelSet
+setFilter f (LS s) = LS (S.filter (f . mkHooplLabel) s)
+
+{-# INLINE setFromList #-}
+setFromList :: [Label] -> LabelSet
+setFromList ks  = LS (S.fromList (map lblToUnique ks))
+
+{-# INLINE nonDetSetFoldl #-}
+nonDetSetFoldl :: (t -> Label -> t) -> t -> LabelSet -> t
+nonDetSetFoldl k z (LS s) = S.foldl (\a v -> k a (mkHooplLabel v)) z s
+
+{-# INLINE nonDetSetFoldr #-}
+nonDetSetFoldr :: (Label -> t -> t) -> t -> LabelSet -> t
+nonDetSetFoldr k z (LS s) = S.foldr (\v a -> k (mkHooplLabel v) a) z s
+
+{-# INLINE nonDetSetElems #-}
+nonDetSetElems :: LabelSet -> [Label]
+nonDetSetElems (LS s) = map mkHooplLabel (S.elems s)
+
+-----------------------------------------------------------------------------
+-- LabelMap
+
+newtype LabelMap v = LM (Word64Map v)
+  deriving newtype (Eq, Ord, Show, Functor)
+
+mapNull :: LabelMap a -> Bool
+mapNull (LM m) = M.null m
+
+{-# INLINE mapSize #-}
+mapSize :: LabelMap a -> Int
+mapSize (LM m) = M.size m
+
+mapMember :: Label -> LabelMap a -> Bool
+mapMember (Label k) (LM m) = M.member k m
+
+mapLookup :: Label -> LabelMap a -> Maybe a
+mapLookup (Label k) (LM m) = M.lookup k m
+
+mapFindWithDefault :: a -> Label -> LabelMap a -> a
+mapFindWithDefault def (Label k) (LM m) = M.findWithDefault def k m
+
+mapEmpty :: LabelMap v
+mapEmpty = LM M.empty
+
+mapSingleton :: Label -> v -> LabelMap v
+mapSingleton (Label k) v = LM (M.singleton k v)
+
+mapInsert :: Label -> v -> LabelMap v -> LabelMap v
+mapInsert (Label k) v (LM m) = LM (M.insert k v m)
+
+mapInsertWith :: (v -> v -> v) -> Label -> v -> LabelMap v -> LabelMap v
+mapInsertWith f (Label k) v (LM m) = LM (M.insertWith f k v m)
+
+mapDelete :: Label -> LabelMap v -> LabelMap v
+mapDelete (Label k) (LM m) = LM (M.delete k m)
+
+mapAlter :: (Maybe v -> Maybe v) -> Label -> LabelMap v -> LabelMap v
+mapAlter f (Label k) (LM m) = LM (M.alter f k m)
+
+mapAdjust :: (v -> v) -> Label -> LabelMap v -> LabelMap v
+mapAdjust f (Label k) (LM m) = LM (M.adjust f k m)
+
+mapUnion :: LabelMap v -> LabelMap v -> LabelMap v
+mapUnion (LM x) (LM y) = LM (M.union x y)
+
+{-# INLINE mapUnions #-}
+mapUnions :: [LabelMap a] -> LabelMap a
+mapUnions [] = mapEmpty
+mapUnions maps = foldl1' mapUnion maps
+
+mapUnionWithKey :: (Label -> v -> v -> v) -> LabelMap v -> LabelMap v -> LabelMap v
+mapUnionWithKey f (LM x) (LM y) = LM (M.unionWithKey (f . mkHooplLabel) x y)
+
+mapDifference :: LabelMap v -> LabelMap b -> LabelMap v
+mapDifference (LM x) (LM y) = LM (M.difference x y)
+
+mapIntersection :: LabelMap v -> LabelMap b -> LabelMap v
+mapIntersection (LM x) (LM y) = LM (M.intersection x y)
+
+mapIsSubmapOf :: Eq a => LabelMap a -> LabelMap a -> Bool
+mapIsSubmapOf (LM x) (LM y) = M.isSubmapOf x y
+
+mapMap :: (a -> v) -> LabelMap a -> LabelMap v
+mapMap f (LM m) = LM (M.map f m)
+
+mapMapWithKey :: (Label -> a -> v) -> LabelMap a -> LabelMap v
+mapMapWithKey f (LM m) = LM (M.mapWithKey (f . mkHooplLabel) m)
+
+{-# INLINEABLE mapFilter #-}
+mapFilter :: (v -> Bool) -> LabelMap v -> LabelMap v
+mapFilter f (LM m) = LM (M.filter f m)
+
+{-# INLINEABLE mapFilterWithKey #-}
+mapFilterWithKey :: (Label -> v -> Bool) -> LabelMap v -> LabelMap v
+mapFilterWithKey f (LM m)  = LM (M.filterWithKey (f . mkHooplLabel) m)
+
+{-# INLINE mapFromList #-}
+mapFromList :: [(Label, v)] -> LabelMap v
+mapFromList assocs = LM (M.fromList [(lblToUnique k, v) | (k, v) <- assocs])
+
+mapFromListWith :: (v -> v -> v) -> [(Label, v)] -> LabelMap v
+mapFromListWith f assocs = LM (M.fromListWith f [(lblToUnique k, v) | (k, v) <- assocs])
+
+{-# INLINE nonDetMapElems #-}
+nonDetMapElems :: LabelMap a -> [a]
+nonDetMapElems (LM m) = M.elems m
+
+{-# INLINE nonDetMapFoldl #-}
+nonDetMapFoldl :: (a -> b -> a) -> a -> LabelMap b -> a
+nonDetMapFoldl k z (LM m) = M.foldl k z m
+
+{-# INLINE nonDetMapFoldr #-}
+nonDetMapFoldr :: (a -> b -> b) -> b -> LabelMap a -> b
+nonDetMapFoldr k z (LM m) = M.foldr k z m
+
+{-# INLINE nonDetMapFoldlWithKey #-}
+nonDetMapFoldlWithKey :: (t -> Label -> b -> t) -> t -> LabelMap b -> t
+nonDetMapFoldlWithKey k z (LM m) = M.foldlWithKey (\a v -> k a (mkHooplLabel v)) z m
+
+nonDetMapFoldMapWithKey :: Monoid m => (Label -> t -> m) -> LabelMap t -> m
+nonDetMapFoldMapWithKey f (LM m) = M.foldMapWithKey (\k v -> f (mkHooplLabel k) v) m
+
+{-# INLINE nonDetMapKeys #-}
+nonDetMapKeys :: LabelMap a -> [Label]
+nonDetMapKeys (LM m) = map (mkHooplLabel . fst) (M.toList m)
+
+{-# INLINE nonDetMapToList #-}
+nonDetMapToList :: LabelMap b -> [(Label, b)]
+nonDetMapToList (LM m) = [(mkHooplLabel k, v) | (k, v) <- M.toList m]
+
+-----------------------------------------------------------------------------
+-- Instances
+
+instance Outputable LabelSet where
+  ppr = ppr . nonDetSetElems
+
+instance Outputable a => Outputable (LabelMap a) where
+  ppr = ppr . nonDetMapToList
+
+instance OutputableP env a => OutputableP env (LabelMap a) where
+  pdoc env = pdoc env . nonDetMapToList
+
+-- instance TrieMap LabelMap where
+--   type Key LabelMap = Label
+--   emptyTM       = mapEmpty
+--   lookupTM k m  = mapLookup k m
+--   alterTM k f m = mapAlter f k m
+--   foldTM k m z  = mapFoldr k z m -- TODO:ERROR?
+--   filterTM f m  = mapFilter f m
+
+-----------------------------------------------------------------------------
+-- FactBase
+
+type FactBase f = LabelMap f
+
+lookupFact :: Label -> FactBase f -> Maybe f
+lookupFact = mapLookup


=====================================
compiler/GHC/Cmm/Graph.hs
=====================================
@@ -32,7 +32,7 @@ import GHC.Cmm.Switch (SwitchTargets)
 
 import GHC.Cmm.Dataflow.Block
 import GHC.Cmm.Dataflow.Graph
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label.NonDet
 import GHC.Data.FastString
 import GHC.Types.ForeignCall
 import GHC.Data.OrdList


=====================================
compiler/GHC/Cmm/Info/Build.hs
=====================================
@@ -23,6 +23,8 @@ import GHC.Cmm.Config
 import GHC.Cmm.Dataflow.Block
 import GHC.Cmm.Dataflow.Graph
 import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label.NonDet (lookupFact)
+import qualified GHC.Cmm.Dataflow.Label.NonDet as NonDet
 import GHC.Cmm.Dataflow
 import GHC.Unit.Module
 import GHC.Data.Graph.Directed
@@ -532,7 +534,7 @@ newtype CAFfyLabel = CAFfyLabel CLabel
 deriving newtype instance OutputableP env CLabel => OutputableP env CAFfyLabel
 
 type CAFSet = Set CAFfyLabel
-type CAFEnv = LabelMap CAFSet
+type CAFEnv = NonDet.LabelMap CAFSet
 
 -- | Records the CAFfy references of a set of static data decls.
 type DataCAFEnv = Map CLabel CAFSet
@@ -599,7 +601,7 @@ cafAnal
   -> CAFEnv
 cafAnal platform contLbls topLbl cmmGraph =
   analyzeCmmBwd cafLattice
-    (cafTransfers platform contLbls (g_entry cmmGraph) topLbl) cmmGraph mapEmpty
+    (cafTransfers platform contLbls (g_entry cmmGraph) topLbl) cmmGraph NonDet.mapEmpty
 
 
 cafLattice :: DataflowLattice CAFSet
@@ -659,7 +661,7 @@ cafTransfers platform contLbls entry topLbl
                                 text "topLbl:"       <+> pdoc platform topLbl $$
                                 text "cafs in exit:" <+> pdoc platform joined $$
                                 text "result:"       <+> pdoc platform result) $
-        mapSingleton (entryLabel eNode) result
+        NonDet.mapSingleton (entryLabel eNode) result
 
 
 -- -----------------------------------------------------------------------------
@@ -775,7 +777,7 @@ depAnalSRTs platform cafEnv cafEnv_static decls =
           | (l, lbl) <- labelledBlocks
           , Just (cafs :: Set CAFfyLabel) <-
               [case l of
-                 BlockLabel l -> mapLookup l cafEnv
+                 BlockLabel l -> NonDet.mapLookup l cafEnv
                  DeclLabel cl -> Map.lookup cl cafEnv_static]
           , let cafs' = Set.delete lbl cafs
           ]
@@ -810,7 +812,7 @@ getCAFs platform cafEnv = mapMaybe getCAFLabel
       | Just info <- mapLookup (g_entry g) (info_tbls top_info)
       , let rep = cit_rep info
       , isStaticRep rep && isThunkRep rep
-      , Just cafs <- mapLookup (g_entry g) cafEnv
+      , Just cafs <- NonDet.mapLookup (g_entry g) cafEnv
       = Just (Just (g_entry g), mkCAFfyLabel platform top_lbl, cafs)
 
       | otherwise
@@ -902,7 +904,7 @@ doSRTs cfg moduleSRTInfo procs data_ = do
                 CmmStaticsRaw lbl _ -> (lbl, set)
 
       (proc_envs, procss) = unzip procs
-      cafEnv = mapUnions proc_envs
+      cafEnv = NonDet.mapUnions proc_envs
       decls = map (cmmDataDeclCmmDecl . snd) data_ ++ concat procss
       staticFuns = mapFromList (getStaticFuns decls)
 


=====================================
compiler/GHC/Cmm/LayoutStack.hs
=====================================
@@ -1,4 +1,5 @@
 {-# LANGUAGE RecordWildCards, GADTs #-}
+{-# OPTIONS_GHC -ddump-simpl -ddump-stg-final -ddump-to-file -dumpdir=/var/folders/tv/35hlch6s3y15hfvndc71l6d40000gn/T/tmp.bJv7ldTSvf #-}
 module GHC.Cmm.LayoutStack (
        cmmLayoutStack, setInfoTableStackMap
   ) where
@@ -26,6 +27,7 @@ import GHC.Cmm.Dataflow.Block
 import GHC.Cmm.Dataflow.Graph
 import GHC.Cmm.Dataflow.Label
 import GHC.Types.Unique.Supply
+import qualified GHC.Cmm.Dataflow.Label.NonDet as NonDet
 import GHC.Data.Maybe
 import GHC.Types.Unique.FM
 import GHC.Utils.Misc
@@ -235,7 +237,7 @@ instance Outputable StackMap where
 
 
 cmmLayoutStack :: CmmConfig -> ProcPointSet -> ByteOff -> CmmGraph
-               -> UniqSM (CmmGraph, LabelMap StackMap)
+               -> UniqSM (CmmGraph, NonDet.LabelMap StackMap)
 cmmLayoutStack cfg procpoints entry_args
                graph@(CmmGraph { g_entry = entry })
   = do
@@ -262,17 +264,17 @@ cmmLayoutStack cfg procpoints entry_args
 
 layout :: CmmConfig
        -> LabelSet                      -- proc points
-       -> LabelMap CmmLocalLive         -- liveness
+       -> NonDet.LabelMap CmmLocalLive         -- liveness
        -> BlockId                       -- entry
        -> ByteOff                       -- stack args on entry
 
-       -> LabelMap StackMap             -- [final] stack maps
+       -> NonDet.LabelMap StackMap      -- [final] stack maps
        -> ByteOff                       -- [final] Sp high water mark
 
        -> [CmmBlock]                    -- [in] blocks
 
        -> UniqSM
-          ( LabelMap StackMap           -- [out] stack maps
+          ( NonDet.LabelMap StackMap    -- [out] stack maps
           , ByteOff                     -- [out] Sp high water mark
           , [CmmBlock]                  -- [out] new blocks
           )
@@ -282,12 +284,18 @@ layout cfg procpoints liveness entry entry_args final_stackmaps final_sp_high bl
   where
     (updfr, cont_info)  = collectContInfo blocks
 
-    init_stackmap = mapSingleton entry StackMap{ sm_sp   = entry_args
-                                               , sm_args = entry_args
-                                               , sm_ret_off = updfr
-                                               , sm_regs = emptyUFM
-                                               }
-
+    init_stackmap = NonDet.mapSingleton entry
+                      StackMap{ sm_sp   = entry_args
+                              , sm_args = entry_args
+                              , sm_ret_off = updfr
+                              , sm_regs = emptyUFM
+                              }
+
+    go :: [Block CmmNode C C]
+       -> NonDet.LabelMap StackMap
+       -> StackLoc
+       -> [CmmBlock]
+       -> UniqDSM (NonDet.LabelMap StackMap, StackLoc, [CmmBlock])
     go [] acc_stackmaps acc_hwm acc_blocks
       = return (acc_stackmaps, acc_hwm, acc_blocks)
 
@@ -296,7 +304,7 @@ layout cfg procpoints liveness entry entry_args final_stackmaps final_sp_high bl
        let (entry0@(CmmEntry entry_lbl tscope), middle0, last0) = blockSplit b0
 
        let stack0 at StackMap { sm_sp = sp0 }
-               = mapFindWithDefault
+               = NonDet.mapFindWithDefault
                      (pprPanic "no stack map for" (ppr entry_lbl))
                      entry_lbl acc_stackmaps
 
@@ -328,7 +336,7 @@ layout cfg procpoints liveness entry entry_args final_stackmaps final_sp_high bl
                manifestSp cfg final_stackmaps stack0 sp0 final_sp_high
                           entry0 middle_pre sp_off last1 fixup_blocks
 
-       let acc_stackmaps' = mapUnion acc_stackmaps out
+       let acc_stackmaps' = NonDet.mapUnion acc_stackmaps out
 
            -- If this block jumps to the GC, then we do not take its
            -- stack usage into account for the high-water mark.
@@ -340,7 +348,7 @@ layout cfg procpoints liveness entry entry_args final_stackmaps final_sp_high bl
            this_sp_hwm | isGcJump last0 = 0
                        | otherwise      = sp0 - sp_off
 
-           hwm' = maximum (acc_hwm : this_sp_hwm : map sm_sp (mapElems out))
+           hwm' = maximum (acc_hwm : this_sp_hwm : map sm_sp (NonDet.nonDetMapElems out))
 
        go bs acc_stackmaps' hwm' (final_blocks ++ acc_blocks)
 
@@ -393,7 +401,7 @@ collectContInfo blocks
 -- on the stack and need to be immediately saved across a call, we
 -- want to just leave them where they are on the stack.
 --
-procMiddle :: LabelMap StackMap -> CmmNode e x -> StackMap -> StackMap
+procMiddle :: NonDet.LabelMap StackMap -> CmmNode e x -> StackMap -> StackMap
 procMiddle stackmaps node sm
   = case node of
      CmmAssign (CmmLocal r) (CmmLoad (CmmStackSlot area off) _ _)
@@ -404,10 +412,10 @@ procMiddle stackmaps node sm
      _other
        -> sm
 
-getStackLoc :: Area -> ByteOff -> LabelMap StackMap -> StackLoc
+getStackLoc :: Area -> ByteOff -> NonDet.LabelMap StackMap -> StackLoc
 getStackLoc Old       n _         = n
 getStackLoc (Young l) n stackmaps =
-  case mapLookup l stackmaps of
+  case NonDet.mapLookup l stackmaps of
     Nothing -> pprPanic "getStackLoc" (ppr l)
     Just sm -> sm_sp sm - sm_args sm + n
 
@@ -432,8 +440,8 @@ getStackLoc (Young l) n stackmaps =
 -- extra code that goes *after* the Sp adjustment.
 
 handleLastNode
-   :: CmmConfig -> ProcPointSet -> LabelMap CmmLocalLive -> LabelMap ByteOff
-   -> LabelMap StackMap -> StackMap -> CmmTickScope
+   :: CmmConfig -> ProcPointSet -> NonDet.LabelMap CmmLocalLive -> LabelMap ByteOff
+   -> NonDet.LabelMap StackMap -> StackMap -> CmmTickScope
    -> Block CmmNode O O
    -> CmmNode O C
    -> UniqSM
@@ -441,7 +449,7 @@ handleLastNode
       , ByteOff            -- amount to adjust Sp
       , CmmNode O C        -- new last node
       , [CmmBlock]         -- new blocks
-      , LabelMap StackMap  -- stackmaps for the continuations
+      , NonDet.LabelMap StackMap  -- stackmaps for the continuations
       )
 
 handleLastNode cfg procpoints liveness cont_info stackmaps
@@ -452,7 +460,7 @@ handleLastNode cfg procpoints liveness cont_info stackmaps
       --  is cml_args, after popping any other junk from the stack.
       CmmCall{ cml_cont = Nothing, .. } -> do
         let sp_off = sp0 - cml_args
-        return ([], sp_off, last, [], mapEmpty)
+        return ([], sp_off, last, [], NonDet.mapEmpty)
 
       --  At each CmmCall with a continuation:
       CmmCall{ cml_cont = Just cont_lbl, .. } ->
@@ -473,20 +481,20 @@ handleLastNode cfg procpoints liveness cont_info stackmaps
                  , ByteOff
                  , CmmNode O C
                  , [CmmBlock]
-                 , LabelMap StackMap
+                 , NonDet.LabelMap StackMap
                  )
      lastCall lbl cml_args cml_ret_args cml_ret_off
       =  ( assignments
          , spOffsetForCall sp0 cont_stack cml_args
          , last
          , [] -- no new blocks
-         , mapSingleton lbl cont_stack )
+         , NonDet.mapSingleton lbl cont_stack )
       where
          (assignments, cont_stack) = prepareStack lbl cml_ret_args cml_ret_off
 
 
      prepareStack lbl cml_ret_args cml_ret_off
-       | Just cont_stack <- mapLookup lbl stackmaps
+       | Just cont_stack <- NonDet.mapLookup lbl stackmaps
              -- If we have already seen this continuation before, then
              -- we just have to make the stack look the same:
        = (fixupStack stack0 cont_stack, cont_stack)
@@ -506,7 +514,7 @@ handleLastNode cfg procpoints liveness cont_info stackmaps
                                 , ByteOff
                                 , CmmNode O C
                                 , [CmmBlock]
-                                , LabelMap StackMap )
+                                , NonDet.LabelMap StackMap )
 
      handleBranches
          -- See Note [diamond proc point]
@@ -515,8 +523,9 @@ handleLastNode cfg procpoints liveness cont_info stackmaps
        = do
          let cont_args = mapFindWithDefault 0 l cont_info
              (assigs, cont_stack) = prepareStack l cont_args (sm_ret_off stack0)
-             out = mapFromList [ (l', cont_stack)
-                               | l' <- successors last ]
+             out = NonDet.mapFromList
+                     [ (l', cont_stack)
+                     | l' <- successors last ]
          return ( assigs
                 , spOffsetForCall sp0 cont_stack (platformWordSizeInBytes platform)
                 , last
@@ -532,7 +541,7 @@ handleLastNode cfg procpoints liveness cont_info stackmaps
                  , 0
                  , mapSuccessors fix_lbl last
                  , concat [ blk | (_,_,_,blk) <- pps ]
-                 , mapFromList [ (l, sm) | (l,_,sm,_) <- pps ] )
+                 , NonDet.mapFromList [ (l, sm) | (l,_,sm,_) <- pps ] )
 
      -- For each successor of this block
      handleBranch :: BlockId -> UniqSM (BlockId, BlockId, StackMap, [CmmBlock])
@@ -540,7 +549,7 @@ handleLastNode cfg procpoints liveness cont_info stackmaps
         --   (a) if the successor already has a stackmap, we need to
         --       shuffle the current stack to make it look the same.
         --       We have to insert a new block to make this happen.
-        | Just stack2 <- mapLookup l stackmaps
+        | Just stack2 <- NonDet.mapLookup l stackmaps
         = do
              let assigs = fixupStack stack0 stack2
              (tmp_lbl, block) <- makeFixupBlock cfg sp0 l stack2 tscp assigs
@@ -563,7 +572,7 @@ handleLastNode cfg procpoints liveness cont_info stackmaps
         --       the destination, because this StackMap might be used
         --       by fixupStack if this is a join point.
         | otherwise = return (l, l, stack1, [])
-        where live = mapFindWithDefault (panic "handleBranch") l liveness
+        where live = NonDet.mapFindWithDefault (panic "handleBranch") l liveness
               stack1 = stack0 { sm_regs = filterUFM is_live (sm_regs stack0) }
               is_live (r,_) = r `elemRegSet` live
 
@@ -612,7 +621,7 @@ fixupStack old_stack new_stack = concatMap move new_locs
 setupStackFrame
              :: Platform
              -> BlockId                 -- label of continuation
-             -> LabelMap CmmLocalLive   -- liveness
+             -> NonDet.LabelMap CmmLocalLive   -- liveness
              -> ByteOff      -- updfr
              -> ByteOff      -- bytes of return values on stack
              -> StackMap     -- current StackMap
@@ -622,7 +631,7 @@ setupStackFrame platform lbl liveness updfr_off ret_args stack0
   = (cont_stack, assignments)
   where
       -- get the set of LocalRegs live in the continuation
-      live = mapFindWithDefault Set.empty lbl liveness
+      live = NonDet.mapFindWithDefault Set.empty lbl liveness
 
       -- the stack from the base to updfr_off is off-limits.
       -- our new stack frame contains:
@@ -824,7 +833,7 @@ allocate platform ret_off live stackmap at StackMap{ sm_sp = sp0
 --
 manifestSp
    :: CmmConfig
-   -> LabelMap StackMap  -- StackMaps for other blocks
+   -> NonDet.LabelMap StackMap  -- StackMaps for other blocks
    -> StackMap           -- StackMap for this block
    -> ByteOff            -- Sp on entry to the block
    -> ByteOff            -- SpHigh
@@ -857,10 +866,10 @@ manifestSp cfg stackmaps stack0 sp0 sp_high
 
     fixup_blocks' = map (mapBlock3' (id, adj_post_sp, id)) fixup_blocks
 
-getAreaOff :: LabelMap StackMap -> (Area -> StackLoc)
+getAreaOff :: NonDet.LabelMap StackMap -> (Area -> StackLoc)
 getAreaOff _ Old = 0
 getAreaOff stackmaps (Young l) =
-  case mapLookup l stackmaps of
+  case NonDet.mapLookup l stackmaps of
     Just sm -> sm_sp sm - sm_args sm
     Nothing -> pprPanic "getAreaOff" (ppr l)
 
@@ -987,7 +996,7 @@ optStackCheck n = -- Note [Always false stack check]
 -- StackMap will invalidate its mapping there.
 --
 elimStackStores :: StackMap
-                -> LabelMap StackMap
+                -> NonDet.LabelMap StackMap
                 -> (Area -> ByteOff)
                 -> [CmmNode O O]
                 -> [CmmNode O O]
@@ -1009,7 +1018,7 @@ elimStackStores stackmap stackmaps area_off nodes
 -- Update info tables to include stack liveness
 
 
-setInfoTableStackMap :: Platform -> LabelMap StackMap -> CmmDecl -> CmmDecl
+setInfoTableStackMap :: Platform -> NonDet.LabelMap StackMap -> CmmDecl -> CmmDecl
 setInfoTableStackMap platform stackmaps (CmmProc top_info at TopInfo{..} l v g)
   = CmmProc top_info{ info_tbls = mapMapWithKey fix_info info_tbls } l v g
   where
@@ -1019,7 +1028,7 @@ setInfoTableStackMap platform stackmaps (CmmProc top_info at TopInfo{..} l v g)
 
     get_liveness :: BlockId -> Liveness
     get_liveness lbl
-      = case mapLookup lbl stackmaps of
+      = case NonDet.mapLookup lbl stackmaps of
           Nothing -> pprPanic "setInfoTableStackMap" (ppr lbl <+> pdoc platform info_tbls)
           Just sm -> stackMapToLiveness platform sm
 
@@ -1044,18 +1053,18 @@ stackMapToLiveness platform StackMap{..} =
 insertReloadsAsNeeded
     :: Platform
     -> ProcPointSet
-    -> LabelMap StackMap
+    -> NonDet.LabelMap StackMap
     -> BlockId
     -> [CmmBlock]
     -> UniqSM [CmmBlock]
 insertReloadsAsNeeded platform procpoints final_stackmaps entry blocks =
     toBlockList . fst <$>
-        rewriteCmmBwd liveLattice rewriteCC (ofBlockList entry blocks) mapEmpty
+        rewriteCmmBwd liveLattice rewriteCC (ofBlockList entry blocks) NonDet.mapEmpty
   where
     rewriteCC :: RewriteFun CmmLocalLive
     rewriteCC (BlockCC e_node middle0 x_node) fact_base0 = do
         let entry_label = entryLabel e_node
-            stackmap = case mapLookup entry_label final_stackmaps of
+            stackmap = case NonDet.mapLookup entry_label final_stackmaps of
                 Just sm -> sm
                 Nothing -> panic "insertReloadsAsNeeded: rewriteCC: stackmap"
 
@@ -1077,7 +1086,7 @@ insertReloadsAsNeeded platform procpoints final_stackmaps entry blocks =
                 = (middle0, live_at_middle0)
 
             -- Final liveness for this block.
-            !fact_base2 = mapSingleton entry_label live_with_reloads
+            !fact_base2 = NonDet.mapSingleton entry_label live_with_reloads
 
         return (BlockCC e_node middle1 x_node, fact_base2)
 


=====================================
compiler/GHC/Cmm/Lint.hs
=====================================
@@ -19,7 +19,7 @@ import GHC.Platform
 import GHC.Platform.Regs (callerSaves)
 import GHC.Cmm.Dataflow.Block
 import GHC.Cmm.Dataflow.Graph
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label.NonDet
 import GHC.Cmm
 import GHC.Cmm.Liveness
 import GHC.Cmm.Switch (switchTargetsToList)


=====================================
compiler/GHC/Cmm/Liveness.hs
=====================================
@@ -19,7 +19,7 @@ import GHC.Cmm.BlockId
 import GHC.Cmm
 import GHC.Cmm.Dataflow.Block
 import GHC.Cmm.Dataflow
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label.NonDet
 import GHC.Cmm.LRegSet
 
 import GHC.Data.Maybe
@@ -57,7 +57,7 @@ cmmLocalLiveness platform graph =
   where
     entry = g_entry graph
     check facts =
-        noLiveOnEntry entry (expectJust "check" $ mapLookup entry facts) facts
+        noLiveOnEntry entry (expectJust "check" $ lookupFact entry facts) facts
 
 cmmGlobalLiveness :: Platform -> CmmGraph -> BlockEntryLiveness GlobalReg
 cmmGlobalLiveness platform graph =
@@ -120,7 +120,7 @@ cmmLocalLivenessL platform graph =
   where
     entry = g_entry graph
     check facts =
-        noLiveOnEntryL entry (expectJust "check" $ mapLookup entry facts) facts
+        noLiveOnEntryL entry (expectJust "check" $ lookupFact entry facts) facts
 
 -- | On entry to the procedure, there had better not be any LocalReg's live-in.
 noLiveOnEntryL :: BlockId -> LRegSet -> a -> a


=====================================
compiler/GHC/Cmm/Pipeline.hs
=====================================
@@ -11,7 +11,7 @@ import GHC.Cmm
 import GHC.Cmm.Config
 import GHC.Cmm.ContFlowOpt
 import GHC.Cmm.CommonBlockElim
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label.NonDet
 import GHC.Cmm.Info.Build
 import GHC.Cmm.Lint
 import GHC.Cmm.LayoutStack


=====================================
compiler/GHC/Cmm/ProcPoint.hs
=====================================
@@ -29,6 +29,7 @@ import GHC.Cmm.Dataflow.Block
 import GHC.Cmm.Dataflow
 import GHC.Cmm.Dataflow.Graph
 import GHC.Cmm.Dataflow.Label
+import qualified GHC.Cmm.Dataflow.Label.NonDet as NonDet
 
 -- Compute a minimal set of proc points for a control-flow graph.
 
@@ -134,7 +135,7 @@ instance Outputable Status where
 -- Once you know what the proc-points are, figure out
 -- what proc-points each block is reachable from
 -- See Note [Proc-point analysis]
-procPointAnalysis :: ProcPointSet -> CmmGraph -> LabelMap Status
+procPointAnalysis :: ProcPointSet -> CmmGraph -> NonDet.LabelMap Status
 procPointAnalysis procPoints cmmGraph@(CmmGraph {g_graph = graph}) =
     analyzeCmmFwd procPointLattice procPointTransfer cmmGraph initProcPoints
   where
@@ -196,14 +197,14 @@ extendPPSet
 extendPPSet platform g blocks procPoints =
     let env = procPointAnalysis procPoints g
         add pps block = let id = entryLabel block
-                        in  case mapLookup id env of
+                        in  case NonDet.mapLookup id env of
                               Just ProcPoint -> setInsert id pps
                               _ -> pps
         procPoints' = foldlGraphBlocks add setEmpty g
         newPoints = mapMaybe ppSuccessor blocks
         newPoint  = listToMaybe newPoints
         ppSuccessor b =
-            let nreached id = case mapLookup id env `orElse`
+            let nreached id = case NonDet.mapLookup id env `orElse`
                                     pprPanic "no ppt" (ppr id <+> pdoc platform b) of
                                 ProcPoint -> 1
                                 ReachedBy ps -> setSize ps
@@ -235,7 +236,7 @@ extendPPSet platform g blocks procPoints =
 -- Input invariant: A block should only be reachable from a single ProcPoint.
 -- ToDo: use the _ret naming convention that the old code generator
 -- used. -- EZY
-splitAtProcPoints :: Platform -> CLabel -> ProcPointSet-> ProcPointSet -> LabelMap Status -> CmmDecl
+splitAtProcPoints :: Platform -> CLabel -> ProcPointSet-> ProcPointSet -> NonDet.LabelMap Status -> CmmDecl
                   -> UniqSM [CmmDecl]
 splitAtProcPoints _ _ _ _ _ t@(CmmData _ _) = return [t]
 splitAtProcPoints platform entry_label callPPs procPoints procMap cmmProc = do
@@ -249,7 +250,7 @@ splitAtProcPoints platform entry_label callPPs procPoints procMap cmmProc = do
 
   let add_block :: LabelMap (LabelMap CmmBlock) -> CmmBlock -> LabelMap (LabelMap CmmBlock)
       add_block graphEnv b =
-        case mapLookup bid procMap of
+        case NonDet.mapLookup bid procMap of
           Just ProcPoint -> add graphEnv bid bid b
           Just (ReachedBy set) ->
             case setElems set of
@@ -263,7 +264,7 @@ splitAtProcPoints platform entry_label callPPs procPoints procMap cmmProc = do
 
   let liveness = cmmGlobalLiveness platform g
   let ppLiveness pp = filter isArgReg $ regSetToList $
-                        expectJust "ppLiveness" $ mapLookup pp liveness
+                        expectJust "ppLiveness" $ NonDet.mapLookup pp liveness
   graphEnv <- return $ foldlGraphBlocks add_block mapEmpty g
 
   -- Build a map from proc point BlockId to pairs of:


=====================================
compiler/GHC/Cmm/Sink.hs
=====================================
@@ -14,7 +14,7 @@ import GHC.Cmm.Liveness
 import GHC.Cmm.LRegSet
 import GHC.Cmm.Utils
 import GHC.Cmm.Dataflow.Block
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label.NonDet
 import GHC.Cmm.Dataflow.Graph
 import GHC.Platform.Regs
 


=====================================
compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
=====================================
@@ -40,7 +40,7 @@ import GHC.Cmm.Utils
 import GHC.Cmm.Switch
 import GHC.Cmm.CLabel
 import GHC.Cmm.Dataflow.Block
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (LabelMap, mapEmpty, mapLookup, mapInsert)
 import GHC.Cmm.Dataflow.Graph
 import GHC.Types.Tickish ( GenTickish(..) )
 import GHC.Types.SrcLoc  ( srcSpanFile, srcSpanStartLine, srcSpanStartCol )


=====================================
compiler/GHC/CmmToAsm/BlockLayout.hs
=====================================
@@ -26,7 +26,8 @@ import GHC.CmmToAsm.Config
 
 import GHC.Cmm
 import GHC.Cmm.BlockId
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (LabelMap, mapMember, mapLookup, mapElems, mapKeys, mapEmpty, mapInsert, mapDelete, mapFromList, mapMap)
+import GHC.Cmm.Dataflow.Label.NonDet (LabelSet, setEmpty, setMember, setFromList, setInsert)
 
 import GHC.Types.Unique.FM
 


=====================================
compiler/GHC/CmmToAsm/PIC.hs
=====================================
@@ -60,7 +60,7 @@ import GHC.CmmToAsm.Config
 import GHC.CmmToAsm.Types
 
 
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (mapMember)
 import GHC.Cmm
 import GHC.Cmm.CLabel
 import GHC.Cmm.Utils (cmmLoadBWord)


=====================================
compiler/GHC/CmmToAsm/Reg/Graph/Spill.hs
=====================================
@@ -15,7 +15,7 @@ import GHC.CmmToAsm.Instr
 import GHC.Platform.Reg
 import GHC.Cmm hiding (RegSet)
 import GHC.Cmm.BlockId
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (mapFoldlWithKey, mapLookup, mapInsert)
 
 import GHC.Utils.Monad
 import GHC.Utils.Monad.State.Strict


=====================================
compiler/GHC/CmmToAsm/Reg/Graph/SpillClean.hs
=====================================
@@ -49,7 +49,7 @@ import GHC.Utils.Monad.State.Strict
 import GHC.Utils.Outputable
 import GHC.Utils.Panic
 import GHC.Platform
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (mapLookup)
 
 import Data.List (nub, foldl1', find)
 import Data.Maybe


=====================================
compiler/GHC/CmmToAsm/Reg/Graph/SpillCost.hs
=====================================
@@ -24,7 +24,7 @@ import GHC.Platform.Reg
 
 import GHC.Data.Graph.Base
 
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (mapLookup, Label, LabelMap)
 import GHC.Cmm
 import GHC.Types.Unique.FM
 import GHC.Types.Unique.Set


=====================================
compiler/GHC/CmmToAsm/Reg/Linear.hs
=====================================
@@ -122,7 +122,7 @@ import GHC.Platform.Reg
 import GHC.Platform.Reg.Class (RegClass(..))
 
 import GHC.Cmm.BlockId
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (mapLookup)
 import GHC.Cmm hiding (RegSet)
 
 import GHC.Data.Graph.Directed


=====================================
compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs
=====================================
@@ -23,7 +23,7 @@ import GHC.CmmToAsm.Types
 import GHC.Platform.Reg
 
 import GHC.Cmm.BlockId
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (mapLookup)
 import GHC.Data.Graph.Directed
 import GHC.Utils.Panic
 import GHC.Utils.Monad (concatMapM)


=====================================
compiler/GHC/CmmToAsm/Reg/Liveness.hs
=====================================
@@ -46,7 +46,8 @@ import GHC.CmmToAsm.Types
 import GHC.CmmToAsm.Utils
 
 import GHC.Cmm.BlockId
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (mapToList, LabelMap, mapInsert, mapEmpty, mapFilterWithKey, mapLookup, mapMap)
+import GHC.Cmm.Dataflow.Label.NonDet (LabelSet, setMember, setFromList)
 import GHC.Cmm hiding (RegSet, emptyRegSet)
 
 import GHC.Data.Graph.Directed


=====================================
compiler/GHC/CmmToAsm/Wasm/FromCmm.hs
=====================================
@@ -34,7 +34,7 @@ import GHC.Cmm
 import GHC.Cmm.BlockId
 import GHC.Cmm.CLabel
 import GHC.Cmm.Dataflow.Block
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label.NonDet
 import GHC.Cmm.InitFini
 import GHC.CmmToAsm.Wasm.Types
 import GHC.CmmToAsm.Wasm.Utils


=====================================
compiler/GHC/CmmToAsm/X86/CodeGen.hs
=====================================
@@ -66,7 +66,7 @@ import GHC.Cmm.Switch
 import GHC.Cmm
 import GHC.Cmm.Dataflow.Block
 import GHC.Cmm.Dataflow.Graph
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (LabelMap, mapMember)
 import GHC.Cmm.CLabel
 import GHC.Types.Tickish ( GenTickish(..) )
 import GHC.Types.SrcLoc  ( srcSpanFile, srcSpanStartLine, srcSpanStartCol )


=====================================
compiler/GHC/CmmToAsm/X86/Instr.hs
=====================================
@@ -54,7 +54,7 @@ import GHC.CmmToAsm.Reg.Target
 import GHC.CmmToAsm.Config
 
 import GHC.Cmm.BlockId
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label.NonDet
 import GHC.Platform.Regs
 import GHC.Cmm
 import GHC.Utils.Outputable


=====================================
compiler/GHC/CmmToLlvm/CodeGen.hs
=====================================
@@ -24,7 +24,7 @@ import GHC.Cmm.Utils
 import GHC.Cmm.Switch
 import GHC.Cmm.Dataflow.Block
 import GHC.Cmm.Dataflow.Graph
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (mapLookup)
 
 import GHC.Data.FastString
 import GHC.Data.OrdList


=====================================
compiler/GHC/Data/Graph/Collapse.hs
=====================================
@@ -22,7 +22,7 @@ import Control.Monad
 import Data.List (delete, union, insert, intersect)
 import Data.Semigroup
 
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label.NonDet
 import GHC.Data.Graph.Inductive.Graph
 import GHC.Types.Unique.Supply
 import GHC.Utils.Panic hiding (assert)


=====================================
compiler/GHC/StgToCmm/Heap.hs
=====================================
@@ -33,7 +33,7 @@ import GHC.StgToCmm.Closure
 
 import GHC.Cmm.Graph
 
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label.NonDet
 import GHC.Runtime.Heap.Layout
 import GHC.Cmm.BlockId
 import GHC.Cmm


=====================================
compiler/GHC/StgToCmm/Monad.hs
=====================================
@@ -76,7 +76,7 @@ import GHC.StgToCmm.Sequel
 import GHC.Cmm.Graph as CmmGraph
 import GHC.Cmm.BlockId
 import GHC.Cmm.CLabel
-import GHC.Cmm.Dataflow.Label
+import GHC.Cmm.Dataflow.Label (mapSingleton, mapEmpty)
 import GHC.Runtime.Heap.Layout
 import GHC.Unit
 import GHC.Types.Id


=====================================
compiler/GHC/Types/Unique/DFM.hs
=====================================
@@ -21,6 +21,7 @@ is not deterministic.
 {-# LANGUAGE ScopedTypeVariables #-}
 {-# LANGUAGE TupleSections #-}
 {-# OPTIONS_GHC -Wall #-}
+{-# OPTIONS_GHC -ddump-simpl -ddump-stg-final -ddump-to-file -dumpdir=/var/folders/tv/35hlch6s3y15hfvndc71l6d40000gn/T/tmp.bJv7ldTSvf #-}
 
 module GHC.Types.Unique.DFM (
         -- * Unique-keyed deterministic mappings


=====================================
compiler/ghc.cabal.in
=====================================
@@ -237,6 +237,7 @@ Library
         GHC.Cmm.Dataflow.Block
         GHC.Cmm.Dataflow.Graph
         GHC.Cmm.Dataflow.Label
+        GHC.Cmm.Dataflow.Label.NonDet
         GHC.Cmm.DebugBlock
         GHC.Cmm.Expr
         GHC.Cmm.GenericOpt



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a7e58e4100d9e33f22a478447a05efd359bf3a2c...89ffb1862cb6c729c93691968c2804d6cf15838a

-- 
This project does not include diff previews in email notifications.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/a7e58e4100d9e33f22a478447a05efd359bf3a2c...89ffb1862cb6c729c93691968c2804d6cf15838a
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240711/e77c375c/attachment-0001.html>


More information about the ghc-commits mailing list