summaryrefslogtreecommitdiff
path: root/compiler/simplCore
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2016-02-26 17:12:52 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2016-02-26 17:16:25 +0000
commite193f66669eda712e832a05349055f8e518f770a (patch)
treebbd8b6307e49ef613231ba0100b3bb82d6186f9b /compiler/simplCore
parentb4dfe04aa77bb2d0ce2c7d82cab5e4425e0b738c (diff)
downloadhaskell-e193f66669eda712e832a05349055f8e518f770a.tar.gz
Filter out BuiltinRules in occurrence analysis
Fixes Trac #11651. Merge to 8.0.
Diffstat (limited to 'compiler/simplCore')
-rw-r--r--compiler/simplCore/OccurAnal.hs14
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/simplCore/OccurAnal.hs b/compiler/simplCore/OccurAnal.hs
index d1c3ca809a..3eb20d0143 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.
+-}
+
{-
************************************************************************
* *