[Git][ghc/ghc][wip/T24623] Wibbles

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Fri Jun 14 22:16:12 UTC 2024



Simon Peyton Jones pushed to branch wip/T24623 at Glasgow Haskell Compiler / GHC


Commits:
631c09b5 by Simon Peyton Jones at 2024-06-14T23:15:57+01:00
Wibbles

- - - - -


2 changed files:

- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Types/Demand.hs


Changes:

=====================================
compiler/GHC/Core/Opt/DmdAnal.hs
=====================================
@@ -1008,7 +1008,7 @@ dmdTransform :: AnalEnv   -- ^ The analysis environment
              -> DmdType   -- ^ The demand type unleashed by the variable in this
                           -- context. The returned DmdEnv includes the demand on
                           -- this function plus demand on its free variables
--- See Note [What are demand signatures?] in "GHC.Types.Demand"
+-- See Note [DmdSig: demand signatures, and demand-sig arity] in "GHC.Types.Demand"
 dmdTransform env var sd
   -- Data constructors
   | Just con <- isDataConWorkId_maybe var
@@ -1086,7 +1086,7 @@ dmdAnalRhsSig top_lvl rec_flag env let_sd id rhs
     (final_env, weak_fvs, final_id, final_rhs)
   where
     ww_arity = workWrapArity id rhs
-      -- See Note [WorkWrap arity and join points, point (1)]
+      -- See Note [Worker/wrapper arity and join points] point (1)
 
     body_sd | isJoinId id = let_sd
             | otherwise   = topSubDmd


=====================================
compiler/GHC/Types/Demand.hs
=====================================
@@ -1041,8 +1041,8 @@ peelManyCalls k sd = go k C_11 sd
 calledOnceArity :: SubDemand -> Arity
 calledOnceArity sd = go 0 sd
   where
-    go n (viewCall -> Call C_11 sd) = go (n+1) sd
-    go n _                          = n
+    go n (viewCall -> Just (C_11, sd)) = go (n+1) sd
+    go n _                             = n
 
 -- | Extract the 'SubDemand' of a 'Demand'.
 -- PRECONDITION: The SubDemand must be used in a context where the expression
@@ -2216,8 +2216,8 @@ being a newtype wrapper around DmdType, it actually encodes two things:
 Here comes the subtle part: The threshold is encoded in the demand-sig arity!
 So in mkDmdSigForArity we make sure to trim the list of argument demands to the
 given threshold arity. Call sites will make sure that this corresponds to the
-arity of the call demand that elicited the wrapped demand type. See also Note
-[What are demand signatures?].
+arity of the call demand that elicited the wrapped demand type. See also
+Note [DmdSig: demand signatures, and demand-sig arity]
 -}
 
 -- | The depth of the wrapped 'DmdType' encodes the arity at which it is safe
@@ -2379,7 +2379,7 @@ etaConvertDmdSig arity (DmdSig dmd_ty)
 -- whether it diverges.
 --
 -- See Note [Understanding DmdType and DmdSig]
--- and Note [What are demand signatures?].
+-- and Note [DmdSig: demand signatures, and demand-sig arity]
 type DmdTransformer = SubDemand -> DmdType
 
 -- | Extrapolate a demand signature ('DmdSig') into a 'DmdTransformer'.
@@ -2390,7 +2390,7 @@ dmdTransformSig :: DmdSig -> DmdTransformer
 dmdTransformSig (DmdSig dmd_ty@(DmdType _ arg_ds)) sd
   = multDmdType (fst $ peelManyCalls (length arg_ds) sd) dmd_ty
     -- see Note [Demands from unsaturated function calls]
-    -- and Note [What are demand signatures?]
+    -- and Note [DmdSig: demand signatures, and demand-sig arity]
 
 -- | A special 'DmdTransformer' for data constructors that feeds product
 -- demands into the constructor arguments.



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/631c09b57186e84e451cd8abb36db1f5d72c7ff6

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/631c09b57186e84e451cd8abb36db1f5d72c7ff6
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/20240614/a4aef433/attachment-0001.html>


More information about the ghc-commits mailing list