[commit: ghc] ghc-8.0: Filter out BuiltinRules in occurrence analysis (934022c)
git at git.haskell.org
git at git.haskell.org
Sat Feb 27 15:21:35 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/934022c088778303fcfac9c63d8c2fd4a4f1fdc2/ghc
>---------------------------------------------------------------
commit 934022c088778303fcfac9c63d8c2fd4a4f1fdc2
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Fri Feb 26 17:12:52 2016 +0000
Filter out BuiltinRules in occurrence analysis
Fixes Trac #11651. Merge to 8.0.
(cherry picked from commit e193f66669eda712e832a05349055f8e518f770a)
>---------------------------------------------------------------
934022c088778303fcfac9c63d8c2fd4a4f1fdc2
compiler/simplCore/OccurAnal.hs | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs
index d1c3ca8..3eb20d0 100644
--- a/compiler/simplCore/OccurAnal.hs
+++ b/compiler/simplCore/OccurAnal.hs
@@ -86,6 +86,7 @@ occurAnalysePgm this_mod active_rule imp_rules vects vectVars binds
imp_rule_edges = foldr (plusVarEnv_C unionVarSet) emptyVarEnv
[ mapVarEnv (const maps_to) (exprFreeIds arg `delVarSetList` ru_bndrs imp_rule)
| imp_rule <- imp_rules
+ , not (isBuiltinRule imp_rule) -- See Note [Plugin rules]
, let maps_to = exprFreeIds (ru_rhs imp_rule)
`delVarSetList` ru_bndrs imp_rule
, arg <- ru_args imp_rule ]
@@ -114,6 +115,19 @@ occurAnalyseExpr' enable_binder_swap expr
-- To be conservative, we say that all inlines and rules are active
all_active_rules = \_ -> True
+{- Note [Plugin rules]
+~~~~~~~~~~~~~~~~~~~~~~
+Conal Eliot (Trac #11651) built a GHC plugin that added some
+BuiltinRules (for imported Ids) to the mg_rules field of ModGuts, to
+do some domain-specific transformations that could not be expressed
+with an ordinary pattern-matching CoreRule. But then we can't extract
+the dependencies (in imp_rule_edges) from ru_rhs etc, because a
+BuiltinRule doesn't have any of that stuff.
+
+So we simply assume that BuiltinRules have no dependencies, and filter
+them out from the imp_rule_edges comprehension.
+-}
+
{-
************************************************************************
* *
More information about the ghc-commits
mailing list