Commit 3a99265e authored by simonpj's avatar simonpj
Browse files

[project @ 2005-07-08 16:16:37 by simonpj]

MERGE TO STABLE (once I"ve checked it works)

The dictionary-floating code in Specialise wasn't taking 
variables free in the RULES into account, which resulted in
such variables perhaps going out of scope.
parent 428d8026
...@@ -23,7 +23,7 @@ import VarSet ...@@ -23,7 +23,7 @@ import VarSet
import VarEnv import VarEnv
import CoreSyn import CoreSyn
import CoreUtils ( applyTypeToArgs, mkPiTypes ) import CoreUtils ( applyTypeToArgs, mkPiTypes )
import CoreFVs ( exprFreeVars, exprsFreeVars ) import CoreFVs ( exprFreeVars, exprsFreeVars, idRuleVars )
import CoreTidy ( tidyRules ) import CoreTidy ( tidyRules )
import CoreLint ( showPass, endPass ) import CoreLint ( showPass, endPass )
import Rules ( addIdSpecialisations, mkLocalRule, lookupRule, emptyRuleBase, rulesOfBinds ) import Rules ( addIdSpecialisations, mkLocalRule, lookupRule, emptyRuleBase, rulesOfBinds )
...@@ -1050,11 +1050,16 @@ zapCalls ids uds = uds {calls = delListFromFM (calls uds) ids} ...@@ -1050,11 +1050,16 @@ zapCalls ids uds = uds {calls = delListFromFM (calls uds) ids}
mkDB bind = (bind, bind_fvs bind) mkDB bind = (bind, bind_fvs bind)
bind_fvs (NonRec bndr rhs) = exprFreeVars rhs bind_fvs (NonRec bndr rhs) = pair_fvs (bndr,rhs)
bind_fvs (Rec prs) = foldl delVarSet rhs_fvs bndrs bind_fvs (Rec prs) = foldl delVarSet rhs_fvs bndrs
where where
bndrs = map fst prs bndrs = map fst prs
rhs_fvs = unionVarSets [exprFreeVars rhs | (bndr,rhs) <- prs] rhs_fvs = unionVarSets (map pair_fvs prs)
pair_fvs (bndr, rhs) = exprFreeVars rhs `unionVarSet` idRuleVars bndr
-- Don't forget variables mentioned in the
-- rules of the bndr. C.f. OccAnal.addRuleUsage
addDictBind (dict,rhs) uds = uds { dict_binds = mkDB (NonRec dict rhs) `consBag` dict_binds uds } addDictBind (dict,rhs) uds = uds { dict_binds = mkDB (NonRec dict rhs) `consBag` dict_binds uds }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment