diff options
author | Matthew Pickering <matthewtpickering@gmail.com> | 2021-05-13 11:13:45 +0100 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2021-05-14 08:01:42 +0100 |
commit | f6649414d29e74d68369c4406710240331c93ee8 (patch) | |
tree | 8f0af2b9d7f6544f9ca50bf06c1f44eabafb8f45 | |
parent | e0ded198e9ec1c8bb7253506569e7ae47818e791 (diff) | |
download | haskell-wip/tidy-rules.tar.gz |
Tidy: Ignore rules (more) when -fomit-interface-pragmas is onwip/tidy-rules
Before this commit, the RHS of a rule would expose additional definitions, despite
the fact that the rule wouldn't get exposed so it wouldn't be possible
to ever use these definitions.
The net-result is slightly less recompilation when specialisation
introduces rules.
Related to #19836
-rw-r--r-- | compiler/GHC/Iface/Tidy.hs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/GHC/Iface/Tidy.hs b/compiler/GHC/Iface/Tidy.hs index 71e93671b9..bf5d2beb14 100644 --- a/compiler/GHC/Iface/Tidy.hs +++ b/compiler/GHC/Iface/Tidy.hs @@ -647,7 +647,14 @@ chooseExternalIds hsc_env mod omit_prags expose_all binds implicit_binds imp_id_ -- See Note [Which rules to expose] is_external id = isExportedId id || id `elemVarSet` rule_rhs_vars - rule_rhs_vars = mapUnionVarSet ruleRhsFreeVars imp_id_rules + rule_rhs_vars + -- No rules are exposed when omit_prags is enabled see #19836 + -- imp_id_rules are the RULES in /this/ module for /imported/ Ids + -- If omit_prags is True, these rules won't be put in the interface file. + -- But if omit_prags is False, so imp_id_rules are in the interface file for + -- this module, then the local-defined Ids they use must be made external. + | omit_prags = emptyVarSet + | otherwise = mapUnionVarSet ruleRhsFreeVars imp_id_rules binders = map fst $ flattenBinds binds implicit_binders = bindersOfBinds implicit_binds |