diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2017-02-26 22:17:02 -0500 |
---|---|---|
committer | David Feuer <David.Feuer@gmail.com> | 2017-02-26 22:18:14 -0500 |
commit | 76f2cd02ab04818f19be1927c2a640dede3e9dd3 (patch) | |
tree | b11ae998c1e4ce582d67babb1bab2f996cf2ff70 /compiler/specialise/Rules.hs | |
parent | 4f38fa100091152e6497db384af1fecd628e11e5 (diff) | |
download | haskell-76f2cd02ab04818f19be1927c2a640dede3e9dd3.tar.gz |
Occurrence-analyse the result of rule firings
When studying simplCore/should_compile/T7785 I found that a long
chain of maps
map f (map f (map f (map f (...))))
took an unreasonably long time to simplify. The problem got
worse when I started inlining in the InitialPhase, which is how
I stumbled on it.
The solution turned out to be rather simple. It's described in
Note [Occurence-analyse after rule firing]
in Simplify.hs
Reviewers: austin, bgamari
Reviewed By: bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3190
Diffstat (limited to 'compiler/specialise/Rules.hs')
-rw-r--r-- | compiler/specialise/Rules.hs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index ae0798ac2b..2ad4e1cd4e 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -31,7 +31,6 @@ module Rules ( import CoreSyn -- All of it import Module ( Module, ModuleSet, elemModuleSet ) import CoreSubst -import OccurAnal ( occurAnalyseExpr ) import CoreFVs ( exprFreeVars, exprsFreeVars, bindFreeVars , rulesFreeVarsDSet, exprsOrphNames, exprFreeVarsList ) import CoreUtils ( exprType, eqExpr, mkTick, mkTicks, @@ -172,7 +171,7 @@ mkRule :: Module -> Bool -> Bool -> RuleName -> Activation mkRule this_mod is_auto is_local name act fn bndrs args rhs = Rule { ru_name = name, ru_fn = fn, ru_act = act, ru_bndrs = bndrs, ru_args = args, - ru_rhs = occurAnalyseExpr rhs, + ru_rhs = rhs, ru_rough = roughTopNames args, ru_origin = this_mod, ru_orphan = orph, @@ -508,8 +507,7 @@ matchRule dflags rule_env _is_active fn args _rough_args -- Built-in rules can't be switched off, it seems = case match_fn dflags rule_env fn args of Nothing -> Nothing - Just expr -> Just (occurAnalyseExpr expr) - -- We could do this when putting things into the rulebase, I guess + Just expr -> Just expr matchRule _ in_scope is_active _ args rough_args (Rule { ru_name = rule_name, ru_act = act, ru_rough = tpl_tops @@ -522,8 +520,7 @@ matchRule _ in_scope is_active _ args rough_args Just (bind_wrapper, tpl_vals) -> Just (bind_wrapper $ rule_fn `mkApps` tpl_vals) where - rule_fn = occurAnalyseExpr (mkLams tpl_vars rhs) - -- We could do this when putting things into the rulebase, I guess + rule_fn = mkLams tpl_vars rhs --------------------------------------- matchN :: InScopeEnv |