summaryrefslogtreecommitdiff
path: root/compiler/simplCore/OccurAnal.lhs
diff options
context:
space:
mode:
authorManuel M T Chakravarty <chak@cse.unsw.edu.au>2013-02-04 12:48:00 +1100
committerManuel M T Chakravarty <chak@cse.unsw.edu.au>2013-02-04 12:48:00 +1100
commit82a30378475143438d9141b671ac0944333a836f (patch)
treed0222bee8d4cf4105ada213e604c89ef3d25dc71 /compiler/simplCore/OccurAnal.lhs
parentf8fb4a4ed8526679903ab58a058f8f1bcb32f458 (diff)
downloadhaskell-82a30378475143438d9141b671ac0944333a836f.tar.gz
Fix tidying of vectorised code
* We need to keep the vectorised version of a variable alive while the original is alive. * This implies that the vectorised version needs to get into the iface if the original appears in an unfolding.
Diffstat (limited to 'compiler/simplCore/OccurAnal.lhs')
-rw-r--r--compiler/simplCore/OccurAnal.lhs15
1 files changed, 10 insertions, 5 deletions
diff --git a/compiler/simplCore/OccurAnal.lhs b/compiler/simplCore/OccurAnal.lhs
index 5a204f46b5..bcbd8b1619 100644
--- a/compiler/simplCore/OccurAnal.lhs
+++ b/compiler/simplCore/OccurAnal.lhs
@@ -63,9 +63,9 @@ Here's the externally-callable interface:
\begin{code}
occurAnalysePgm :: Module -- Used only in debug output
-> (Activation -> Bool)
- -> [CoreRule] -> [CoreVect]
+ -> [CoreRule] -> [CoreVect] -> VarSet
-> CoreProgram -> CoreProgram
-occurAnalysePgm this_mod active_rule imp_rules vects binds
+occurAnalysePgm this_mod active_rule imp_rules vects vectVars binds
| isEmptyVarEnv final_usage
= binds'
| otherwise -- See Note [Glomming]
@@ -76,8 +76,13 @@ occurAnalysePgm this_mod active_rule imp_rules vects binds
(final_usage, binds') = go (initOccEnv active_rule) binds
initial_uds = addIdOccs emptyDetails
- (rulesFreeVars imp_rules `unionVarSet` vectsFreeVars vects)
- -- The RULES and VECTORISE declarations keep things alive!
+ -- (rulesFreeVars imp_rules `unionVarSet` vectsFreeVars vects)
+ (rulesFreeVars imp_rules `unionVarSet`
+ vectsFreeVars vects `unionVarSet`
+ vectVars)
+ -- The RULES and VECTORISE declarations keep things alive! (For VECTORISE declarations,
+ -- we only get them *until* the vectoriser runs. Afterwards, these dependencies are
+ -- reflected in 'vectors' — see Note [Vectorisation declarations and occurences].)
-- Note [Preventing loops due to imported functions rules]
imp_rules_edges = foldr (plusVarEnv_C unionVarSet) emptyVarEnv
@@ -118,7 +123,7 @@ Bindings
\begin{code}
occAnalBind :: OccEnv -- The incoming OccEnv
-> OccEnv -- Same, but trimmed by (binderOf bind)
- -> IdEnv IdSet -- Mapping from FVs of imported RULE LHSs to RHS FVs
+ -> IdEnv IdSet -- Mapping from FVs of imported RULE LHSs to RHS FVs
-> CoreBind
-> UsageDetails -- Usage details of scope
-> (UsageDetails, -- Of the whole let(rec)