diff options
author | sheaf <sam.derbyshire@gmail.com> | 2022-08-04 11:49:35 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-08-09 13:47:28 -0400 |
commit | d71a20514546e0befe6e238d0658cbaad5a13996 (patch) | |
tree | f249a11e6515fbe9b56e6d5f39957497d670c506 | |
parent | ea90e61dc3c6ba0433e008284dc6c3970ead98a7 (diff) | |
download | haskell-d71a20514546e0befe6e238d0658cbaad5a13996.tar.gz |
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
-rw-r--r-- | compiler/GHC/Core/Unfold.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/GHC/Core/Unfold.hs b/compiler/GHC/Core/Unfold.hs index 7786f2e3a2..017a733ec0 100644 --- a/compiler/GHC/Core/Unfold.hs +++ b/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 |