[Git][ghc/ghc][master] Fix size_up_alloc to account for UnliftedDatatypes

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Tue Aug 9 17:47:43 UTC 2022



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
d71a2051 by sheaf at 2022-08-09T13:47:28-04:00
Fix size_up_alloc to account for UnliftedDatatypes

The size_up_alloc function mistakenly considered any type that isn't
lifted to not allocate anything, which is wrong. What we want instead
is to check the type isn't boxed. This accounts for (BoxedRep Unlifted).

Fixes #21939

- - - - -


1 changed file:

- compiler/GHC/Core/Unfold.hs


Changes:

=====================================
compiler/GHC/Core/Unfold.hs
=====================================
@@ -580,10 +580,9 @@ sizeExpr opts !bOMB_OUT_SIZE top_args expr
     ------------
     -- Cost to allocate binding with given binder
     size_up_alloc bndr
-      |  isTyVar bndr                 -- Doesn't exist at runtime
-      || isJoinId bndr                -- Not allocated at all
-      || isUnliftedType (idType bndr) -- Doesn't live in heap
-           -- OK to call isUnliftedType: binders have a fixed RuntimeRep (search for FRRBinder)
+      |  isTyVar bndr                    -- Doesn't exist at runtime
+      || isJoinId bndr                   -- Not allocated at all
+      || not (isBoxedType (idType bndr)) -- Doesn't live in heap
       = 0
       | otherwise
       = 10



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

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d71a20514546e0befe6e238d0658cbaad5a13996
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/20220809/c2a900d3/attachment.html>


More information about the ghc-commits mailing list