summaryrefslogtreecommitdiff
path: root/compiler/GHC/CoreToIface.hs
diff options
context:
space:
mode:
authorGergő Érdi <gergo@erdi.hu>2022-12-02 03:00:54 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-12-13 22:19:14 -0500
commit884790e2f3480dfcd73b1c094123555956eac6e0 (patch)
tree5fbbc341bc14ec360ab53aa533a5f78900471599 /compiler/GHC/CoreToIface.hs
parente9d74a3e47a4709502d7c1923b8611c22183b777 (diff)
downloadhaskell-884790e2f3480dfcd73b1c094123555956eac6e0.tar.gz
Fix loop in the interface representation of some `Unfolding` fields
As discovered in #22272, dehydration of the unfolding info of a recursive definition used to involve a traversal of the definition itself, which in turn involves traversing the unfolding info. Hence, a loop. Instead, we now store enough data in the interface that we can produce the unfolding info without this traversal. See Note [Tying the 'CoreUnfolding' knot] for details. Fixes #22272 Co-authored-by: Simon Peyton Jones <simon.peytonjones@gmail.com>
Diffstat (limited to 'compiler/GHC/CoreToIface.hs')
-rw-r--r--compiler/GHC/CoreToIface.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/GHC/CoreToIface.hs b/compiler/GHC/CoreToIface.hs
index 88a450e3df..4194939082 100644
--- a/compiler/GHC/CoreToIface.hs
+++ b/compiler/GHC/CoreToIface.hs
@@ -508,9 +508,10 @@ toIfaceJoinInfo Nothing = IfaceNotJoinPoint
toIfUnfolding :: Bool -> Unfolding -> Maybe IfaceInfoItem
toIfUnfolding lb (CoreUnfolding { uf_tmpl = rhs
, uf_src = src
+ , uf_cache = cache
, uf_guidance = guidance })
= Just $ HsUnfold lb $
- IfCoreUnfold src (toIfGuidance src guidance) (toIfaceExpr rhs)
+ IfCoreUnfold src cache (toIfGuidance src guidance) (toIfaceExpr rhs)
-- Yes, even if guidance is UnfNever, expose the unfolding
-- If we didn't want to expose the unfolding, GHC.Iface.Tidy would
-- have stuck in NoUnfolding. For supercompilation we want