diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2015-07-21 14:41:08 +0100 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2015-07-21 15:57:13 +0100 |
commit | feaa0951f5cb6d54fffc5df822c03dfcb6db0e58 (patch) | |
tree | 239dbd9385874db00a5bea2821cec9b72cdacb45 /compiler/specialise/Rules.hs | |
parent | 55754ea34bd42ae88121311e9d0f29e90cce8166 (diff) | |
download | haskell-feaa0951f5cb6d54fffc5df822c03dfcb6db0e58.tar.gz |
Do occurrence analysis on result of BuiltInRule
Previously we did occurrence analysis on the result of a
non-built-in RULE, but not of a built-in one. It makes a
difference if the rule returns something with binders
(which admittedly it usually does not). I'm about to
introduce just such a rule for 'seq'.
Diffstat (limited to 'compiler/specialise/Rules.hs')
-rw-r--r-- | compiler/specialise/Rules.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index 7cf6e56bb7..f1288ccc64 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -483,7 +483,7 @@ matchRule :: DynFlags -> InScopeEnv -> (Activation -> Bool) -- then (f args) matches the rule, and the corresponding -- rewritten RHS is rhs -- --- The bndrs and rhs is occurrence-analysed +-- The returned expression is occurrence-analysed -- -- Example -- @@ -505,8 +505,9 @@ matchRule dflags rule_env _is_active fn args _rough_args (BuiltinRule { ru_try = match_fn }) -- Built-in rules can't be switched off, it seems = case match_fn dflags rule_env fn args of - Just expr -> Just expr Nothing -> Nothing + Just expr -> Just (occurAnalyseExpr expr) + -- We could do this when putting things into the rulebase, I guess matchRule _ in_scope is_active _ args rough_args (Rule { ru_act = act, ru_rough = tpl_tops |