[Git][ghc/ghc][wip/romes/12935] 4 commits: Get rid of UniqRenamable class, do it directly

Rodrigo Mesquita (@alt-romes) gitlab at gitlab.haskell.org
Thu Aug 15 16:02:49 UTC 2024



Rodrigo Mesquita pushed to branch wip/romes/12935 at Glasgow Haskell Compiler / GHC


Commits:
0bbd6274 by Rodrigo Mesquita at 2024-08-08T15:38:41+01:00
Get rid of UniqRenamable class, do it directly

- - - - -
caf3cff6 by Rodrigo Mesquita at 2024-08-08T18:03:45+01:00
Performance tweaks

- - - - -
8c7d40f7 by Rodrigo Mesquita at 2024-08-08T18:07:39+01:00
Make sure graph is renamed first, info table last

Turns out it does matter!

- - - - -
dd304be5 by Rodrigo Mesquita at 2024-08-15T17:02:09+01:00
TEMPORARY: Workaround simplifier det c. by rules

by the non deterministic loading of rules really

- - - - -


3 changed files:

- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/UniqueRenamer.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs


Changes:

=====================================
compiler/GHC/Cmm/CLabel.hs
=====================================
@@ -1906,5 +1906,6 @@ mapInternalNonDetUniques f x = case x of
   HpcTicksLabel mod -> pure $ HpcTicksLabel mod
   SRTLabel unique -> SRTLabel <$> f unique
   LargeBitmapLabel unique -> LargeBitmapLabel <$> f unique
-
+-- This is called *a lot* if renaming Cmm uniques, and won't specialise without this pragma:
+{-# INLINABLE mapInternalNonDetUniques #-}
 


=====================================
compiler/GHC/Cmm/UniqueRenamer.hs
=====================================
@@ -11,7 +11,8 @@ module GHC.Cmm.UniqueRenamer
   where
 
 import Prelude
-import Control.Monad.Trans.State
+import GHC.Utils.Monad.State.Strict
+import Data.Tuple (swap)
 import GHC.Word
 import GHC.Cmm
 import GHC.Cmm.CLabel
@@ -22,7 +23,6 @@ import GHC.Cmm.Switch
 import GHC.Types.Unique
 import GHC.Types.Unique.FM
 import GHC.Utils.Outputable as Outputable
-import Data.Tuple (swap)
 import GHC.Types.Id
 import GHC.Types.Unique.DSM
 import GHC.Types.Name hiding (varName)
@@ -46,8 +46,8 @@ Topics:
 -- rename local symbols with the end goal of producing deterministic object files.
 -- See Note [....TODO]
 data DetUniqFM = DetUniqFM
-  { mapping :: UniqFM Unique Unique
-  , supply :: !Word64
+  { mapping :: !(UniqFM Unique Unique)
+  , supply  :: !Word64
   }
 
 instance Outputable DetUniqFM where
@@ -55,7 +55,6 @@ instance Outputable DetUniqFM where
     ppr mapping $$
     text "supply:" Outputable.<> ppr supply
 
--- ToDo: Use ReaderT UniqDSM instead of this?
 type DetRnM = State DetUniqFM
 
 emptyDetUFM :: DetUniqFM
@@ -63,7 +62,7 @@ emptyDetUFM = DetUniqFM
   { mapping = emptyUFM
   -- NB: A lower initial value can get us label `Lsl` which is not parsed
   -- correctly in older versions of LLVM assembler (llvm-project#80571)
-  -- So we use a x s.t. w64ToBase62 x > "R" > "L" > "r" > "l"
+  -- So we use an `x` s.t. w64ToBase62 x > "R" > "L" > "r" > "l"
   , supply = 54
   }
 
@@ -74,8 +73,9 @@ renameDetUniq uq = do
     Nothing -> do
       new_w <- gets supply -- New deterministic unique in this `DetRnM`
       let --(_, _) = unpkUnique uq
+          -- TODO: DO NOT LEAVE IT LIKE THIS?
           det_uniq = mkUnique 'Q' new_w
-      modify' (\DetUniqFM{mapping, supply} ->
+      modify (\DetUniqFM{mapping, supply} ->
         -- Update supply and mapping
         DetUniqFM
           { mapping = addToUFM mapping uq det_uniq
@@ -85,41 +85,7 @@ renameDetUniq uq = do
     Just det_uniq ->
       return det_uniq
 
--- Rename local symbols deterministically (in order of appearance)
---detRename0Uniques :: UniqRenamable a => DetUniqFM -> a -> (DetUniqFM, a)
---detRenameUniques dufm x = swap $ runState (uniqRename x) dufm
-
-detRenameCmmGroup :: DetUniqFM -> DCmmGroup -> (DetUniqFM, CmmGroup)
-detRenameCmmGroup dufm group = swap (runState (mapM go group) dufm)
-  where
-    go :: DCmmDecl -> State DetUniqFM CmmDecl
-    go (CmmProc h lbl regs g)
-      = do
-        g' <- goCmmGraph g
-        regs' <- uniqRename regs
-        lbl' <- uniqRename lbl
-        --- rename h last!!! (TODO: Check if this is really still needed now that LabelMap is deterministic. My guess is this is not needed at all.
-        h' <- goTop h
-        return $ CmmProc h' lbl' regs' g'
-    go (CmmData sec d)
-      = CmmData <$> uniqRename sec <*> uniqRename d
-
-    goTop :: DCmmTopInfo -> State DetUniqFM CmmTopInfo
-    goTop (TopInfo (DWrap i) b) = TopInfo . mapFromList <$> uniqRename i <*> pure b
-
-    goCmmGraph :: DCmmGraph -> State DetUniqFM CmmGraph
-    goCmmGraph (CmmGraph entry bs) = CmmGraph <$> uniqRename entry <*> goGraph bs
-
-    goGraph = \case
-      GNil  -> pure GNil
-      GUnit block -> GUnit <$> uniqRename block
-      GMany m1 b m2 -> GMany <$> uniqRename m1 <*> goBody b <*> uniqRename m2
-
-    goBody (DWrap b) = mapFromList <$> uniqRename b
-
-
 -- The most important function here, which does the actual renaming.
--- Arguably, maybe we should rename this to CLabelRenamer
 detRenameCLabel :: CLabel -> DetRnM CLabel
 detRenameCLabel = mapInternalNonDetUniques renameDetUniq
 
@@ -129,163 +95,157 @@ detRenameId i
   | isExternalName (varName i) = return i
   | otherwise = setIdUnique i <$> renameDetUniq (getUnique i)
 
---------------------------------------------------------------------------------
--- Traversals
---------------------------------------------------------------------------------
--- I think I should be able to implement this using some generic traversal,
--- which would be cleaner
-
-class UniqRenamable a where
-  uniqRename :: a -> DetRnM a
-
-instance UniqRenamable Unique where
-  uniqRename = renameDetUniq
-
-instance UniqRenamable CLabel where
-  -- The most important renaming. The rest are just traversals.
-  uniqRename = detRenameCLabel
-
-instance UniqRenamable LocalReg where
-  uniqRename (LocalReg uq t) = LocalReg <$> renameDetUniq uq <*> pure t
-  -- uniqRename (LocalReg uq t) = pure $ LocalReg uq t
-    -- ROMES:TODO: This has unique r1, we're debugging. this may still be a source of non determinism.
-
-instance UniqRenamable Label where
-  uniqRename lbl = mkHooplLabel . getKey <$> renameDetUniq (getUnique lbl)
-
-instance UniqRenamable CmmTickScope where
-  -- ROMES:TODO: We may have to change this to get deterministic objects with ticks.
-  uniqRename = pure
-
-instance UniqRenamable CmmDataDecl where
-  uniqRename (CmmData sec d)
-    = CmmData <$> uniqRename sec <*> uniqRename d
-  uniqRename _ = error "impossible"
-
-instance UniqRenamable CmmStatics where
-  uniqRename (CmmStatics clbl info ccs lits1 lits2)
-    = CmmStatics <$> uniqRename clbl <*> uniqRename info <*> pure ccs <*> mapM uniqRename lits1 <*> mapM uniqRename lits2
-  uniqRename (CmmStaticsRaw lbl sts)
-    = CmmStaticsRaw <$> uniqRename lbl <*> mapM uniqRename sts
-
-instance UniqRenamable CmmInfoTable where
-  uniqRename CmmInfoTable{cit_lbl, cit_rep, cit_prof, cit_srt, cit_clo}
-      = CmmInfoTable <$> uniqRename cit_lbl <*> pure cit_rep <*> pure cit_prof <*> uniqRename cit_srt <*>
-         (case cit_clo of
-            Nothing -> pure Nothing
-            Just (an_id, ccs) -> Just . (,ccs) <$> detRenameId an_id)
-
-instance UniqRenamable Section where
-  uniqRename (Section ty lbl) = Section ty <$> uniqRename lbl
-
-instance UniqRenamable RawCmmStatics where
-  uniqRename (CmmStaticsRaw lbl sts)
-    = CmmStaticsRaw <$> uniqRename lbl <*> mapM uniqRename sts
-
-instance UniqRenamable CmmStatic where
-  uniqRename = \case
-    CmmStaticLit l -> CmmStaticLit <$> uniqRename l
-    CmmUninitialised x -> pure $ CmmUninitialised x
-    CmmString x -> pure $ CmmString x
-    CmmFileEmbed f i -> pure $ CmmFileEmbed f i
-
-instance UniqRenamable CmmLit where
-  uniqRename = \case
-    CmmInt i w -> pure $ CmmInt i w
-    CmmFloat r w -> pure $ CmmFloat r w
-    CmmVec lits -> CmmVec <$> mapM uniqRename lits
-    CmmLabel lbl -> CmmLabel <$> uniqRename lbl
-    CmmLabelOff lbl i -> CmmLabelOff <$> uniqRename lbl <*> pure i
-    CmmLabelDiffOff lbl1 lbl2 i w ->
-      CmmLabelDiffOff <$> uniqRename lbl1 <*> uniqRename lbl2 <*> pure i <*> pure w
-    CmmBlock bid -> CmmBlock <$> uniqRename bid
-    CmmHighStackMark -> pure CmmHighStackMark
-
-{- instance UniqRenamable CmmGraph where
-  uniqRename (CmmGraph e g) = CmmGraph <$> uniqRename e <*> uniqRename g
-  -}
-
-
-{- instance UniqRenamable (Graph  CmmNode n m) where
-  uniqRename = \case
-    GNil  -> pure GNil
-    GUnit block -> GUnit <$> uniqRename block
-    GMany m1 b m2 -> GMany <$> uniqRename m1 <*> uniqRename b <*> uniqRename m2
-    -}
-
-instance UniqRenamable t => UniqRenamable (MaybeO n t) where
-  uniqRename (JustO x) = JustO <$> uniqRename x
-  uniqRename NothingO = pure NothingO
-
-instance UniqRenamable (Block CmmNode n m) where
-  uniqRename = \case
-    BlockCO n bn -> BlockCO <$> uniqRename n <*> uniqRename bn
-    BlockCC n1 bn n2 -> BlockCC <$> uniqRename n1 <*> uniqRename bn <*> uniqRename n2
-    BlockOC bn n -> BlockOC <$> uniqRename bn <*> uniqRename n
-    BNil    -> pure BNil
-    BMiddle n -> BMiddle <$> uniqRename n
-    BCat    b1 b2 -> BCat <$> uniqRename b1 <*> uniqRename b2
-    BSnoc   bn n -> BSnoc <$> uniqRename bn <*> uniqRename n
-    BCons   n bn -> BCons <$> uniqRename n <*> uniqRename bn
-
-instance UniqRenamable (CmmNode n m) where
-  uniqRename = \case
-    CmmEntry l t -> CmmEntry <$> uniqRename l <*> uniqRename t
-    CmmComment fs -> pure $ CmmComment fs
-    CmmTick tickish -> pure $ CmmTick tickish
-    CmmUnwind xs -> CmmUnwind <$> mapM uniqRename xs
-    CmmAssign reg e -> CmmAssign <$> uniqRename reg <*> uniqRename e
-    CmmStore e1 e2 align -> CmmStore <$> uniqRename e1 <*> uniqRename e2 <*> pure align
-    CmmUnsafeForeignCall ftgt cmmformal cmmactual ->
-      CmmUnsafeForeignCall <$> uniqRename ftgt <*> mapM uniqRename cmmformal <*> mapM uniqRename cmmactual
-    CmmBranch l -> CmmBranch <$> uniqRename l
-    CmmCondBranch pred t f likely ->
-      CmmCondBranch <$> uniqRename pred <*> uniqRename t <*> uniqRename f <*> pure likely
-    CmmSwitch e sts -> CmmSwitch <$> uniqRename e <*> mapSwitchTargetsA uniqRename sts
-    CmmCall tgt cont regs args retargs retoff ->
-      CmmCall <$> uniqRename tgt <*> uniqRename cont <*> mapM uniqRename regs
-              <*> pure args <*> pure retargs <*> pure retoff
-    CmmForeignCall tgt res args succ retargs retoff intrbl ->
-      CmmForeignCall <$> uniqRename tgt <*> mapM uniqRename res <*> mapM uniqRename args
-                     <*> uniqRename succ <*> pure retargs <*> pure retoff <*> pure intrbl
-
-instance UniqRenamable GlobalReg where
-  uniqRename = pure
-
-instance UniqRenamable CmmExpr where
-  uniqRename = \case
-    CmmLit l -> CmmLit <$> uniqRename l
-    CmmLoad e t a -> CmmLoad <$> uniqRename e <*> pure t <*> pure a
-    CmmReg r -> CmmReg <$> uniqRename r
-    CmmMachOp mop es -> CmmMachOp mop <$> mapM uniqRename es
-    CmmStackSlot a i -> CmmStackSlot <$> uniqRename a <*> pure i
-    CmmRegOff r i -> CmmRegOff <$> uniqRename r <*> pure i
-
-instance UniqRenamable Area where
-  uniqRename Old = pure Old
-  uniqRename (Young l) = Young <$> uniqRename l
-
-instance UniqRenamable ForeignTarget where
-  uniqRename = \case
-    ForeignTarget e fc -> ForeignTarget <$> uniqRename e <*> pure fc
-    PrimTarget cmop -> pure $ PrimTarget cmop
-
-instance UniqRenamable CmmReg where
-  uniqRename = \case
-    CmmLocal l -> CmmLocal <$> uniqRename l
-    CmmGlobal x -> pure $ CmmGlobal x
-
-instance UniqRenamable a => UniqRenamable [a] where
-  uniqRename = mapM uniqRename
-
-instance (UniqRenamable a, UniqRenamable b) => UniqRenamable (a, b) where
-  uniqRename (a, b) = (,) <$> uniqRename a <*> uniqRename b
-
-instance (UniqRenamable a) => UniqRenamable (Maybe a) where
-  uniqRename Nothing = pure Nothing
-  uniqRename (Just x) = Just <$> uniqRename x
-
--- | Utility panic used by UniqRenamable instances for Map-like datatypes
---panicMapKeysNotInjective :: a -> b -> c
---panicMapKeysNotInjective _ _ = error "this should be impossible because the function which maps keys should be injective"
-
+detRenameCmmGroup :: DetUniqFM -> DCmmGroup -> (DetUniqFM, CmmGroup)
+detRenameCmmGroup dufm group = swap (runState (mapM detRenameCmmDecl group) dufm)
+  where
+    detRenameCmmDecl :: DCmmDecl -> DetRnM CmmDecl
+    detRenameCmmDecl (CmmProc h lbl regs g)
+      = do
+        -- Rename the cmm graph first, where things that need to be renamed
+        -- appear in a deterministic order.
+        g' <- detRenameCmmGraph g
+        regs' <- mapM detRenameGlobalReg regs
+        lbl' <- detRenameCLabel lbl
+        -- Rename the info table last! This is necessary for determinism, the
+        -- info table contents not always appear in the same order accross
+        -- runs. As long as all uniques have already been renamed in a deterministic
+        -- order, renaming the info table uniques will only lookup the
+        -- corresponding deterministic ones rather than creating any.
+        h' <- detRenameCmmTop h
+        return (CmmProc h' lbl' regs' g')
+    detRenameCmmDecl (CmmData sec d)
+      = CmmData <$> detRenameSection sec <*> detRenameCmmStatics d
+
+    detRenameCmmTop :: DCmmTopInfo -> DetRnM CmmTopInfo
+    detRenameCmmTop (TopInfo (DWrap i) b)
+      = TopInfo . mapFromList <$> mapM (detRenamePair detRenameLabel detRenameCmmInfoTable) i <*> pure b
+
+    detRenameCmmGraph :: DCmmGraph -> DetRnM CmmGraph
+    detRenameCmmGraph (CmmGraph entry bs)
+      = CmmGraph <$> detRenameLabel entry <*> detRenameGraph bs
+
+    detRenameGraph = \case
+      GNil  -> pure GNil
+      GUnit block -> GUnit <$> detRenameBlock block
+      GMany m1 b m2 -> GMany <$> detRenameMaybeBlock m1 <*> detRenameBody b <*> detRenameMaybeBlock m2
+
+    detRenameBody (DWrap b)
+      = mapFromList <$> mapM (detRenamePair detRenameLabel detRenameBlock) b
+
+    detRenameCmmStatics :: CmmStatics -> DetRnM CmmStatics
+    detRenameCmmStatics 
+      (CmmStatics clbl info ccs lits1 lits2)
+        = CmmStatics <$> detRenameCLabel clbl <*> detRenameCmmInfoTable info <*> pure ccs <*> mapM detRenameCmmLit lits1 <*> mapM detRenameCmmLit lits2
+    detRenameCmmStatics
+      (CmmStaticsRaw lbl sts)
+        = CmmStaticsRaw <$> detRenameCLabel lbl <*> mapM detRenameCmmStatic sts
+
+    detRenameCmmInfoTable :: CmmInfoTable -> DetRnM CmmInfoTable
+    detRenameCmmInfoTable
+      CmmInfoTable{cit_lbl, cit_rep, cit_prof, cit_srt, cit_clo}
+        = CmmInfoTable <$> detRenameCLabel cit_lbl <*> pure cit_rep <*> pure cit_prof <*> detRenameMaybe detRenameCLabel cit_srt <*>
+           (case cit_clo of
+              Nothing -> pure Nothing
+              Just (an_id, ccs) -> Just . (,ccs) <$> detRenameId an_id)
+
+    detRenameCmmStatic :: CmmStatic -> DetRnM CmmStatic
+    detRenameCmmStatic = \case
+      CmmStaticLit l -> CmmStaticLit <$> detRenameCmmLit l
+      CmmUninitialised x -> pure $ CmmUninitialised x
+      CmmString x -> pure $ CmmString x
+      CmmFileEmbed f i -> pure $ CmmFileEmbed f i
+
+    detRenameCmmLit :: CmmLit -> DetRnM CmmLit
+    detRenameCmmLit = \case
+      CmmInt i w -> pure $ CmmInt i w
+      CmmFloat r w -> pure $ CmmFloat r w
+      CmmVec lits -> CmmVec <$> mapM detRenameCmmLit lits
+      CmmLabel lbl -> CmmLabel <$> detRenameCLabel lbl
+      CmmLabelOff lbl i -> CmmLabelOff <$> detRenameCLabel lbl <*> pure i
+      CmmLabelDiffOff lbl1 lbl2 i w ->
+        CmmLabelDiffOff <$> detRenameCLabel lbl1 <*> detRenameCLabel lbl2 <*> pure i <*> pure w
+      CmmBlock bid -> CmmBlock <$> detRenameLabel bid
+      CmmHighStackMark -> pure CmmHighStackMark
+
+    detRenameMaybeBlock :: MaybeO n (Block CmmNode a b) -> DetRnM (MaybeO n (Block CmmNode a b))
+    detRenameMaybeBlock (JustO x) = JustO <$> detRenameBlock x
+    detRenameMaybeBlock NothingO = pure NothingO
+
+    detRenameBlock :: Block CmmNode n m -> DetRnM (Block CmmNode n m)
+    detRenameBlock = \case
+      BlockCO n bn -> BlockCO <$> detRenameCmmNode n <*> detRenameBlock bn
+      BlockCC n1 bn n2 -> BlockCC <$> detRenameCmmNode n1 <*> detRenameBlock bn <*> detRenameCmmNode n2
+      BlockOC bn n -> BlockOC <$> detRenameBlock bn <*> detRenameCmmNode n
+      BNil    -> pure BNil
+      BMiddle n -> BMiddle <$> detRenameCmmNode n
+      BCat    b1 b2 -> BCat <$> detRenameBlock b1 <*> detRenameBlock b2
+      BSnoc   bn n -> BSnoc <$> detRenameBlock bn <*> detRenameCmmNode n
+      BCons   n bn -> BCons <$> detRenameCmmNode n <*> detRenameBlock bn
+
+    detRenameCmmNode :: CmmNode n m -> DetRnM (CmmNode n m)
+    detRenameCmmNode = \case
+      CmmEntry l t -> CmmEntry <$> detRenameLabel l <*> detRenameCmmTick t
+      CmmComment fs -> pure $ CmmComment fs
+      CmmTick tickish -> pure $ CmmTick tickish
+      CmmUnwind xs -> CmmUnwind <$> mapM (detRenamePair detRenameGlobalReg (detRenameMaybe detRenameCmmExpr)) xs
+      CmmAssign reg e -> CmmAssign <$> detRenameCmmReg reg <*> detRenameCmmExpr e
+      CmmStore e1 e2 align -> CmmStore <$> detRenameCmmExpr e1 <*> detRenameCmmExpr e2 <*> pure align
+      CmmUnsafeForeignCall ftgt cmmformal cmmactual ->
+        CmmUnsafeForeignCall <$> detRenameForeignTarget ftgt <*> mapM detRenameLocalReg cmmformal <*> mapM detRenameCmmExpr cmmactual
+      CmmBranch l -> CmmBranch <$> detRenameLabel l
+      CmmCondBranch pred t f likely ->
+        CmmCondBranch <$> detRenameCmmExpr pred <*> detRenameLabel t <*> detRenameLabel f <*> pure likely
+      CmmSwitch e sts -> CmmSwitch <$> detRenameCmmExpr e <*> mapSwitchTargetsA detRenameLabel sts
+      CmmCall tgt cont regs args retargs retoff ->
+        CmmCall <$> detRenameCmmExpr tgt <*> detRenameMaybe detRenameLabel cont <*> mapM detRenameGlobalReg regs
+                <*> pure args <*> pure retargs <*> pure retoff
+      CmmForeignCall tgt res args succ retargs retoff intrbl ->
+        CmmForeignCall <$> detRenameForeignTarget tgt <*> mapM detRenameLocalReg res <*> mapM detRenameCmmExpr args
+                       <*> detRenameLabel succ <*> pure retargs <*> pure retoff <*> pure intrbl
+
+    detRenameCmmExpr :: CmmExpr -> DetRnM CmmExpr
+    detRenameCmmExpr = \case
+      CmmLit l -> CmmLit <$> detRenameCmmLit l
+      CmmLoad e t a -> CmmLoad <$> detRenameCmmExpr e <*> pure t <*> pure a
+      CmmReg r -> CmmReg <$> detRenameCmmReg r
+      CmmMachOp mop es -> CmmMachOp mop <$> mapM detRenameCmmExpr es
+      CmmStackSlot a i -> CmmStackSlot <$> detRenameArea a <*> pure i
+      CmmRegOff r i -> CmmRegOff <$> detRenameCmmReg r <*> pure i
+
+    detRenameForeignTarget :: ForeignTarget -> DetRnM ForeignTarget
+    detRenameForeignTarget = \case
+        ForeignTarget e fc -> ForeignTarget <$> detRenameCmmExpr e <*> pure fc
+        PrimTarget cmop -> pure $ PrimTarget cmop
+
+    detRenameArea :: Area -> DetRnM Area
+    detRenameArea Old = pure Old
+    detRenameArea (Young l) = Young <$> detRenameLabel l
+
+    detRenameLabel :: Label -> DetRnM Label
+    detRenameLabel lbl
+      = mkHooplLabel . getKey <$> renameDetUniq (getUnique lbl)
+
+    detRenameSection :: Section -> DetRnM Section
+    detRenameSection (Section ty lbl)
+      = Section ty <$> detRenameCLabel lbl
+
+    detRenameCmmReg :: CmmReg -> DetRnM CmmReg
+    detRenameCmmReg = \case
+      CmmLocal l -> CmmLocal <$> detRenameLocalReg l
+      CmmGlobal x -> pure $ CmmGlobal x
+
+    detRenameLocalReg :: LocalReg -> DetRnM LocalReg
+    detRenameLocalReg (LocalReg uq t)
+      = LocalReg <$> renameDetUniq uq <*> pure t
+
+    detRenameGlobalReg :: GlobalReg -> DetRnM GlobalReg
+    detRenameGlobalReg = pure -- Nothing needs to be renamed here
+
+    -- todo: We may have to change this to get deterministic objects with ticks.
+    detRenameCmmTick :: CmmTickScope -> DetRnM CmmTickScope
+    detRenameCmmTick = pure
+
+    detRenameMaybe _ Nothing = pure Nothing
+    detRenameMaybe f (Just x) = Just <$> f x
+
+    detRenamePair f g (a, b) = (,) <$> f a <*> g b


=====================================
compiler/GHC/Core/Opt/Simplify/Iteration.hs
=====================================
@@ -2307,7 +2307,7 @@ rebuildCall env info@(ArgInfo { ai_fun = fun, ai_args = rev_args
 -- See also Note [Trying rewrite rules]
 rebuildCall env info@(ArgInfo { ai_fun = fun, ai_args = rev_args
                               , ai_rewrite = TryRules nr_wanted rules }) cont
-  | nr_wanted == 0 || no_more_args
+  | {- nr_wanted == 0 || -} no_more_args
   = -- We've accumulated a simplified call in <fun,rev_args>
     -- so try rewrite rules; see Note [RULES apply to simplified arguments]
     -- See also Note [Rules for recursive functions]



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/942f75a90770238c1377d6f4b536490988dc883a...dd304be598e6cca82b751caec1a1402210b220eb

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/942f75a90770238c1377d6f4b536490988dc883a...dd304be598e6cca82b751caec1a1402210b220eb
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/20240815/a76d3825/attachment-0001.html>


More information about the ghc-commits mailing list