inlinePragInfo :: InlinePragInfo, -- Inline pragma
occInfo :: OccInfo, -- How it occurs
- newStrictnessInfo :: Maybe StrictSig,
+ newStrictnessInfo :: Maybe StrictSig, -- Reason for Maybe: the DmdAnal phase needs to
+ -- know whether whether this is the first visit,
+ -- so it can assign botSig. Other customers want
+ -- topSig. So Nothing is good.
newDemandInfo :: Demand
}
DmdEnv, emptyDmdEnv,
DmdResult(..), isBotRes, returnsCPR,
- StrictSig(..), mkStrictSig, topSig, botSig,
+ StrictSig(..), mkStrictSig, topSig, botSig, isTopSig,
splitStrictSig, strictSigResInfo,
pprIfaceStrictSig, appIsBottom, isBottomingSig
) where
topDmdType = DmdType emptyDmdEnv [] TopRes
botDmdType = DmdType emptyDmdEnv [] BotRes
+isTopDmdType :: DmdType -> Bool
+-- Only used on top-level types, hence the assert
+isTopDmdType (DmdType _ [] TopRes) = ASSERT( isEmptyVarEnv env) True
+isTopDmdType other = False
+
isBotRes :: DmdResult -> Bool
isBotRes BotRes = True
isBotRes other = False
strictSigResInfo :: StrictSig -> DmdResult
strictSigResInfo (StrictSig (DmdType _ _ res)) = res
+isTopSig (StrictSig ty) = isTopDmdType ty
+
topSig = StrictSig topDmdType
botSig = StrictSig botDmdType
mkVanillaGlobal, mkGlobalId, isLocalId,
isDataConId, mkUserLocal, isGlobalId, globalIdDetails,
idNewDemandInfo, setIdNewDemandInfo,
- idNewStrictness_maybe, setIdNewStrictness
+ idNewStrictness, setIdNewStrictness
)
import IdInfo {- loads of stuff -}
-import NewDemand ( isBottomingSig, topSig, isStrictDmd )
+import NewDemand ( isBottomingSig, topSig, isStrictDmd, isTopSig )
import BasicTypes ( isNeverActive )
import Name ( getOccName, nameOccName, globaliseName, setNameOcc,
localiseName, isGlobalName, setNameUnique
final_id
| totally_boring_info = new_id
| otherwise = new_id `setIdNewDemandInfo` dmd_info
- `setIdNewStrictness` fromJust maybe_new_strictness
+ `setIdNewStrictness` new_strictness
-- override the env we get back from tidyId with the new IdInfo
-- so it gets propagated to the usage sites.
new_var_env = extendVarEnv var_env id final_id
dmd_info = idNewDemandInfo id
- maybe_new_strictness = idNewStrictness_maybe id
- totally_boring_info = isNothing maybe_new_strictness && not (isStrictDmd dmd_info)
+ new_strictness = idNewStrictness id
+ totally_boring_info = isTopSig new_strictness && not (isStrictDmd dmd_info)
tidyIdBndr :: TidyEnv -> Id -> (TidyEnv, Id)
tidyIdBndr env@(tidy_env, var_env) id