diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2011-07-21 12:52:01 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2011-07-21 12:52:01 +0100 |
commit | f88b20f4139773a956430c99664d2db5b8c01202 (patch) | |
tree | 458530f9901c03d4af943d66ec511d89a1334b76 /compiler/simplCore/Simplify.lhs | |
parent | 98e9096cdcfe7501109b66e3a22e7a41eee4521b (diff) | |
download | haskell-f88b20f4139773a956430c99664d2db5b8c01202.tar.gz |
Simplify the treatment of RULES in OccurAnal
I realised that my recently-added cunning stuff about
RULES for imported Ids was simply wrong, so this patch
removes it. See Note [Rules for imported functions],
which explains it all.
This patch also does quite a bit of refactoring in
the treatment of loop breakers.
Diffstat (limited to 'compiler/simplCore/Simplify.lhs')
-rw-r--r-- | compiler/simplCore/Simplify.lhs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/simplCore/Simplify.lhs b/compiler/simplCore/Simplify.lhs index 5202bef5e6..adcaf13133 100644 --- a/compiler/simplCore/Simplify.lhs +++ b/compiler/simplCore/Simplify.lhs @@ -212,6 +212,7 @@ simplTopBinds env0 binds0 -- so that if a transformation rule has unexpectedly brought -- anything into scope, then we don't get a complaint about that. -- It's rather as if the top-level binders were imported. + -- See note [Glomming] in OccurAnal. ; env1 <- simplRecBndrs env0 (bindersOfBinds binds0) ; dflags <- getDOptsSmpl ; let dump_flag = dopt Opt_D_verbose_core2core dflags @@ -1421,17 +1422,15 @@ tryRules env rules fn args call_cont | null rules = return Nothing | otherwise - = do { dflags <- getDOptsSmpl - ; case activeRule dflags env of { - Nothing -> return Nothing ; -- No rules apply - Just act_fn -> - case lookupRule act_fn (getUnfoldingInRuleMatch env) (getInScope env) fn args rules of { + = do { case lookupRule (activeRule env) (getUnfoldingInRuleMatch env) + (getInScope env) fn args rules of { Nothing -> return Nothing ; -- No rule matches Just (rule, rule_rhs) -> do { tick (RuleFired (ru_name rule)) + ; dflags <- getDOptsSmpl ; trace_dump dflags rule rule_rhs $ - return (Just (ruleArity rule, rule_rhs)) }}}} + return (Just (ruleArity rule, rule_rhs)) }}} where trace_dump dflags rule rule_rhs stuff | not (dopt Opt_D_dump_rule_firings dflags) |