[Git][ghc/ghc][wip/T17910] Wibbles to fix VSM

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Thu Sep 21 15:34:52 UTC 2023



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


Commits:
b8e04bc2 by Simon Peyton Jones at 2023-09-21T16:34:35+01:00
Wibbles to fix VSM

SetLevels floats out top  level things if:
bottoming (possibly lambda) and non-strict
expandable and not a con-app
The not-con-app bit is to avoid flattening big data structures
Expandable bit is because specConstr only deals with con-apps, not with fun-apps or lambdas.

- - - - -


1 changed file:

- compiler/GHC/Core/Opt/SetLevels.hs


Changes:

=====================================
compiler/GHC/Core/Opt/SetLevels.hs
=====================================
@@ -735,14 +735,22 @@ lvlMFE env strict_ctxt ann_expr
     escapes_value_lam = dest_lvl `ltMajLvl` (le_ctxt_lvl env)
                   -- See Note [Escaping a value lambda]
 
+    is_con_app (Cast e _) = is_con_app e
+    is_con_app (Var v)    = isDataConWorkId v
+    is_con_app e          = False
+
     -- See Note [Floating to the top]
     saves_alloc =  isTopLvl dest_lvl
+                && (  (is_bot_lam && not strict_ctxt)
+                   || (exprIsExpandable expr && not (is_con_app expr)) )
+{-
                 && (floatConsts env || is_function || is_bot_lam)
                             -- Always float constant lambdas
                             -- T5237 is a good example
                 && (   not strict_ctxt                     -- (a)
                     || exprIsExpandable expr               -- (b)
                     || (is_bot_lam && escapes_value_lam))  -- (c)
+-}
 
 hasFreeJoin :: LevelEnv -> DVarSet -> Bool
 -- Has a free join point which is not being floated to top level.



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b8e04bc21bac0afe86055007828fcddd27622fa3
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/20230921/e8cd7b05/attachment-0001.html>


More information about the ghc-commits mailing list