diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2022-07-15 17:47:32 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2022-11-10 12:20:03 +0000 |
commit | f9f17b68b144a7ecb91395c1e987bbf4f91c0180 (patch) | |
tree | b5e1460afc1926dd30646b6facaa26f87e031efd /compiler/GHC/Driver | |
parent | 90c5abd4581b404f715e72ad55303e18d0c31d68 (diff) | |
download | haskell-f9f17b68b144a7ecb91395c1e987bbf4f91c0180.tar.gz |
Fire RULES in the Specialiser
The Specialiser has, for some time, fires class-op RULES in the
specialiser itself: see
Note [Specialisation modulo dictionary selectors]
This MR beefs it up a bit, so that it fires /all/ RULES in the
specialiser, not just class-op rules. See
Note [Fire rules in the specialiser]
The result is a bit more specialisation; see test
simplCore/should_compile/T21851_2
This pushed me into a bit of refactoring. I made a new data types
GHC.Core.Rules.RuleEnv, which combines
- the several source of rules (local, home-package, external)
- the orphan-module dependencies
in a single record for `getRules` to consult. That drove a bunch of
follow-on refactoring, including allowing me to remove
cr_visible_orphan_mods from the CoreReader data type.
I moved some of the RuleBase/RuleEnv stuff into GHC.Core.Rule.
The reorganisation in the Simplifier improve compile times a bit
(geom mean -0.1%), but T9961 is an outlier
Metric Decrease:
T9961
Diffstat (limited to 'compiler/GHC/Driver')
-rw-r--r-- | compiler/GHC/Driver/Config/Core/Opt/Simplify.hs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/compiler/GHC/Driver/Config/Core/Opt/Simplify.hs b/compiler/GHC/Driver/Config/Core/Opt/Simplify.hs index 86284c8be9..75ae439df3 100644 --- a/compiler/GHC/Driver/Config/Core/Opt/Simplify.hs +++ b/compiler/GHC/Driver/Config/Core/Opt/Simplify.hs @@ -6,7 +6,7 @@ module GHC.Driver.Config.Core.Opt.Simplify import GHC.Prelude -import GHC.Core ( RuleBase ) +import GHC.Core.Rules ( RuleBase ) import GHC.Core.Opt.Pipeline.Types ( CoreToDo(..) ) import GHC.Core.Opt.Simplify ( SimplifyExprOpts(..), SimplifyOpts(..) ) import GHC.Core.Opt.Simplify.Env ( FloatEnable(..), SimplMode(..) ) @@ -40,20 +40,19 @@ initSimplifyExprOpts dflags ic = SimplifyExprOpts } initSimplifyOpts :: DynFlags -> [Var] -> Int -> SimplMode -> RuleBase -> SimplifyOpts -initSimplifyOpts dflags extra_vars iterations mode rule_base = let +initSimplifyOpts dflags extra_vars iterations mode hpt_rule_base = let -- This is a particularly ugly construction, but we will get rid of it in !8341. opts = SimplifyOpts { so_dump_core_sizes = not $ gopt Opt_SuppressCoreSizes dflags - , so_iterations = iterations - , so_mode = mode + , so_iterations = iterations + , so_mode = mode , so_pass_result_cfg = if gopt Opt_DoCoreLinting dflags - then Just $ initLintPassResultConfig dflags extra_vars (CoreDoSimplify opts) - else Nothing - , so_rule_base = rule_base - , so_top_env_cfg = TopEnvConfig - { te_history_size = historySize dflags - , te_tick_factor = simplTickFactor dflags - } + then Just $ initLintPassResultConfig dflags extra_vars + (CoreDoSimplify opts) + else Nothing + , so_hpt_rules = hpt_rule_base + , so_top_env_cfg = TopEnvConfig { te_history_size = historySize dflags + , te_tick_factor = simplTickFactor dflags } } in opts |