diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2022-08-10 09:12:03 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2022-08-19 00:09:11 -0400 |
commit | 519c712ea570210f7a3a1f1449bc26b985eb7db2 (patch) | |
tree | e5ec864b0aa57f0f2ad17444ef8126d05b4adcba | |
parent | 989b844d7598fd71ffd76e00d8d1f5207d58fd61 (diff) | |
download | haskell-519c712ea570210f7a3a1f1449bc26b985eb7db2.tar.gz |
Make ru_fn field strict to avoid retaining Ids
It's better to perform this projection from Id to Name strictly so we
don't retain an old Id (hence IdInfo, hence Unfolding, hence everything
etc)
-rw-r--r-- | compiler/GHC/Core.hs | 2 | ||||
-rw-r--r-- | compiler/GHC/Core/Opt/Simplify/Iteration.hs | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/compiler/GHC/Core.hs b/compiler/GHC/Core.hs index e2e55dbc98..16b428cca4 100644 --- a/compiler/GHC/Core.hs +++ b/compiler/GHC/Core.hs @@ -1151,7 +1151,7 @@ data CoreRule -- Rough-matching stuff -- see comments with InstEnv.ClsInst( is_cls, is_rough ) - ru_fn :: Name, -- ^ Name of the 'GHC.Types.Id.Id' at the head of this rule + ru_fn :: !Name, -- ^ Name of the 'GHC.Types.Id.Id' at the head of this rule ru_rough :: [Maybe Name], -- ^ Name at the head of each argument to the left hand side -- Proper-matching stuff diff --git a/compiler/GHC/Core/Opt/Simplify/Iteration.hs b/compiler/GHC/Core/Opt/Simplify/Iteration.hs index 29639b99ab..96a262d3e1 100644 --- a/compiler/GHC/Core/Opt/Simplify/Iteration.hs +++ b/compiler/GHC/Core/Opt/Simplify/Iteration.hs @@ -4294,7 +4294,8 @@ simplRules env mb_new_id rules bind_cxt lhs_env = updMode updModeForRules env' rhs_env = updMode (updModeForStableUnfoldings act) env' -- See Note [Simplifying the RHS of a RULE] - fn_name' = case mb_new_id of + -- Force this to avoid retaining reference to old Id + !fn_name' = case mb_new_id of Just id -> idName id Nothing -> fn_name |