[Git][ghc/ghc][wip/dmdanal-split-fvs] DmdAnal: Don't `splitFV` strict demands

Sebastian Graf gitlab at gitlab.haskell.org
Sat Oct 24 12:35:48 UTC 2020



Sebastian Graf pushed to branch wip/dmdanal-split-fvs at Glasgow Haskell Compiler / GHC


Commits:
c4176ed4 by Sebastian Graf at 2020-10-24T14:34:14+02:00
DmdAnal: Don't `splitFV` strict demands

The `splitFV` function implements the highly dubious hack
described in `Note [Lazy und unleashable free variables]` in
GHC.Core.Opt.DmdAnal. It arranges it so that demand signatures only
carry strictness info on free variables. Usage info is released through
other means, see the Note. It's purely for analysis performance reasons.

But in case of a strict FV demand, we still add the FV to the demand
signature *and* the lazy_fv DmdEnv. It would be far simpler (and more
precise) not having to split the demand over both places, if analysis
performance doesn't degrade too much.

- - - - -


1 changed file:

- compiler/GHC/Types/Demand.hs


Changes:

=====================================
compiler/GHC/Types/Demand.hs
=====================================
@@ -806,11 +806,9 @@ splitFVs is_thunk rhs_fvs
                 -- in the envs again
   | otherwise = partitionVarEnv isWeakDmd rhs_fvs
   where
-    add uniq dmd@(JD { sd = s, ud = u }) (lazy_fv :*: sig_fv)
+    add uniq dmd@(JD { sd = s }) (lazy_fv :*: sig_fv)
       | Lazy <- s = addToUFM_Directly lazy_fv uniq dmd :*: sig_fv
-      | otherwise = addToUFM_Directly lazy_fv uniq (JD { sd = Lazy, ud = u })
-                    :*:
-                    addToUFM_Directly sig_fv  uniq (JD { sd = s,    ud = Abs })
+      | otherwise = lazy_fv :*: addToUFM_Directly sig_fv  uniq dmd
 
 keepAliveDmdEnv :: DmdEnv -> IdSet -> DmdEnv
 -- (keepAliveDmdType dt vs) makes sure that the Ids in vs have



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/c4176ed45aa296058417ac946ce785193be24b3a
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/20201024/971f3853/attachment.html>


More information about the ghc-commits mailing list