summaryrefslogtreecommitdiff
path: root/compiler/GHC/Core
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-08-10 09:13:33 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-08-19 00:09:11 -0400
commit7dda04b00407c083949363b653538510a1355e12 (patch)
treed9a62f1aab8abd31c15a6bacda2035a135272959 /compiler/GHC/Core
parent519c712ea570210f7a3a1f1449bc26b985eb7db2 (diff)
downloadhaskell-7dda04b00407c083949363b653538510a1355e12.tar.gz
Force `getOccFS bndr` to avoid retaining reference to Bndr.
This is another symptom of #19619
Diffstat (limited to 'compiler/GHC/Core')
-rw-r--r--compiler/GHC/Core/Opt/Simplify/Iteration.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/GHC/Core/Opt/Simplify/Iteration.hs b/compiler/GHC/Core/Opt/Simplify/Iteration.hs
index 96a262d3e1..7ee623b937 100644
--- a/compiler/GHC/Core/Opt/Simplify/Iteration.hs
+++ b/compiler/GHC/Core/Opt/Simplify/Iteration.hs
@@ -634,7 +634,8 @@ tryCastWorkerWrapper env bind_cxt old_bndr occ_info bndr (Cast rhs co)
floats' = floats `extendFloats` NonRec bndr' triv_rhs
; return ( floats', setInScopeFromF env floats' ) } }
where
- occ_fs = getOccFS bndr
+ -- Force the occ_fs so that the old Id is not retained in the new Id.
+ !occ_fs = getOccFS bndr
uf_opts = seUnfoldingOpts env
work_ty = coercionLKind co
info = idInfo bndr
@@ -711,9 +712,11 @@ prepareBinding env top_lvl is_rec strict_bind bndr rhs_floats rhs
-- rhs_env: add to in-scope set the binders from rhs_floats
-- so that prepareRhs knows what is in scope in rhs
; let rhs_env = env `setInScopeFromF` rhs_floats1
+ -- Force the occ_fs so that the old Id is not retained in the new Id.
+ !occ_fs = getOccFS bndr
-- Now ANF-ise the remaining rhs
- ; (anf_floats, rhs2) <- prepareRhs rhs_env top_lvl (getOccFS bndr) rhs1
+ ; (anf_floats, rhs2) <- prepareRhs rhs_env top_lvl occ_fs rhs1
-- Finally, decide whether or not to float
; let all_floats = rhs_floats1 `addLetFloats` anf_floats