X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2FbasicTypes%2FIdInfo.lhs;h=3e64ee562627c7efdc643532e236c1c2d4cb6bd1;hb=c2adbe169694478db4c02fef6e5491622642803d;hp=6b43c687800c482abc0ed24b5f2327792ea00405;hpb=5e04af6de2dd1d86f6bf0599420e32aaa776d055;p=ghc-hetmet.git diff --git a/compiler/basicTypes/IdInfo.lhs b/compiler/basicTypes/IdInfo.lhs index 6b43c68..3e64ee5 100644 --- a/compiler/basicTypes/IdInfo.lhs +++ b/compiler/basicTypes/IdInfo.lhs @@ -72,7 +72,7 @@ module IdInfo ( -- Specialisation SpecInfo(..), specInfo, setSpecInfo, isEmptySpecInfo, - specInfoFreeVars, specInfoRules, seqSpecInfo, + specInfoFreeVars, specInfoRules, seqSpecInfo, setSpecInfoHead, -- CAF info CafInfo(..), cafInfo, ppCafInfo, setCafInfo, mayHaveCafRefs, @@ -89,6 +89,7 @@ module IdInfo ( import CoreSyn import Class import PrimOp +import Name import Var import VarSet import BasicTypes @@ -102,7 +103,6 @@ import Module import Data.Maybe #ifdef OLD_STRICTNESS -import Name import Demand import qualified Demand import Util @@ -474,8 +474,10 @@ type InlinePragInfo = Activation data SpecInfo = SpecInfo [CoreRule] - VarSet -- Locally-defined free vars of *both* LHS and RHS of rules - -- Note [Rule dependency info] + VarSet -- Locally-defined free vars of *both* LHS and RHS + -- of rules. I don't think it needs to include the + -- ru_fn though. + -- Note [Rule dependency info] in OccurAnal emptySpecInfo :: SpecInfo emptySpecInfo = SpecInfo [] emptyVarSet @@ -489,19 +491,15 @@ specInfoFreeVars (SpecInfo _ fvs) = fvs specInfoRules :: SpecInfo -> [CoreRule] specInfoRules (SpecInfo rules _) = rules +setSpecInfoHead :: Name -> SpecInfo -> SpecInfo +setSpecInfoHead fn (SpecInfo rules fvs) + = SpecInfo (map set_head rules) fvs + where + set_head rule = rule { ru_fn = fn } + seqSpecInfo (SpecInfo rules fvs) = seqRules rules `seq` seqVarSet fvs \end{code} -Note [Rule dependency info] -~~~~~~~~~~~~~~~~~~~~~~~~~~~ -THe VarSet in a SpecInfo is used for dependency analysis in the -occurrence analyser. We must track free vars in *both* lhs and rhs. Why both? -Consider - x = y - RULE f x = 4 -Then if we substitute y for x, we'd better do so in the - rule's LHS too, so we'd better ensure the dependency is respsected - %************************************************************************ @@ -724,9 +722,13 @@ zapDemandInfo info@(IdInfo {newDemandInfo = dmd}) \begin{code} zapFragileInfo :: IdInfo -> Maybe IdInfo -- Zap info that depends on free variables -zapFragileInfo info = Just (info `setSpecInfo` emptySpecInfo - `setWorkerInfo` NoWorker - `setUnfoldingInfo` NoUnfolding) +zapFragileInfo info + = Just (info `setSpecInfo` emptySpecInfo + `setWorkerInfo` NoWorker + `setUnfoldingInfo` NoUnfolding + `setOccInfo` if isFragileOcc occ then NoOccInfo else occ) + where + occ = occInfo info \end{code} %************************************************************************