[Git][ghc/ghc][wip/spj-unf-size] Fix scoping bug
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Mon Oct 23 20:52:50 UTC 2023
Simon Peyton Jones pushed to branch wip/spj-unf-size at Glasgow Haskell Compiler / GHC
Commits:
0d908997 by Simon Peyton Jones at 2023-10-23T21:52:38+01:00
Fix scoping bug
- - - - -
1 changed file:
- compiler/GHC/Core/Opt/Simplify/Inline.hs
Changes:
=====================================
compiler/GHC/Core/Opt/Simplify/Inline.hs
=====================================
@@ -230,17 +230,21 @@ tryUnfolding logger env fn cont unf_template unf_cache guidance
BoringCtxt -> False
_ -> True
- zapped_env = zapSubstEnv env
- context = IC { ic_bound = mkVarEnv (arg_bndrs `zip` arg_infos)
- , ic_free = getFreeSummary zapped_env
+ bound_env = mkVarEnv (arg_bndrs `zip` (arg_infos ++ repeat ArgNoInfo))
+ -- Crucial to include /all/ arg_bndrs, lest we treat
+ -- them as free and use ic_free instead
+ context = IC { ic_bound = bound_env
+ , ic_free = getFreeSummary
, ic_want_res = want_result }
size :: Size
size = exprTreeSize context expr_tree
- getFreeSummary :: SimplEnv -> Id -> ArgSummary
+ in_scope = seInScope env
+
+ getFreeSummary :: Id -> ArgSummary
-- Get the ArgSummary of a free variable
- getFreeSummary env x
- = case lookupInScope (seInScope env) x of
+ getFreeSummary x
+ = case lookupInScope in_scope x of
Just x' | warnPprTrace (not (isId x')) "GFS" (vcat
[ ppr fn <+> equals <+> ppr unf_template
, text "expr_tree:" <+> ppr expr_tree
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0d90899712a4be18293d58cacd2941c291664a6b
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/0d90899712a4be18293d58cacd2941c291664a6b
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20231023/a4639d49/attachment-0001.html>
More information about the ghc-commits
mailing list