summaryrefslogtreecommitdiff
path: root/compiler/GHC/Iface
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-08-10 09:16:43 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-08-19 00:09:11 -0400
commit4303acba89b26cc3ae05527d701cba7d84edafcb (patch)
tree3c1acefbd8183dce75582a64819423c5dbf88f49 /compiler/GHC/Iface
parent7dda04b00407c083949363b653538510a1355e12 (diff)
downloadhaskell-4303acba89b26cc3ae05527d701cba7d84edafcb.tar.gz
Force unfoldings when they are cleaned-up in Tidy and CorePrep
If these thunks are not forced then the entire unfolding for the binding is live throughout the whole of CodeGen despite the fact it should have been discarded. Fixes #22071
Diffstat (limited to 'compiler/GHC/Iface')
-rw-r--r--compiler/GHC/Iface/Tidy.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/GHC/Iface/Tidy.hs b/compiler/GHC/Iface/Tidy.hs
index 5f22f0275a..92e7e3c0df 100644
--- a/compiler/GHC/Iface/Tidy.hs
+++ b/compiler/GHC/Iface/Tidy.hs
@@ -1292,12 +1292,14 @@ tidyTopIdInfo uf_opts rhs_tidy_env name rhs_ty orig_rhs tidy_rhs idinfo show_unf
--------- Unfolding ------------
unf_info = realUnfoldingInfo idinfo
- unfold_info
+ -- Force this, otherwise the old unfolding is retained over code generation
+ -- See #22071
+ !unfold_info
| isCompulsoryUnfolding unf_info || show_unfold
= tidyUnfolding rhs_tidy_env unf_info unf_from_rhs
| otherwise
= minimal_unfold_info
- minimal_unfold_info = trimUnfolding unf_info
+ !minimal_unfold_info = trimUnfolding unf_info
unf_from_rhs = mkFinalUnfolding uf_opts InlineRhs final_sig tidy_rhs
-- NB: do *not* expose the worker if show_unfold is off,
-- because that means this thing is a loop breaker or