OutId, OutTyVar, OutBind, OutExpr, OutAlt, OutArg, OutType, OutBndr,
InCoercion, OutCoercion,
- isStrictBndr,
-
-- The simplifier mode
setMode, getMode,
type OutArg = CoreArg
\end{code}
-\begin{code}
-isStrictBndr :: Id -> Bool
-isStrictBndr bndr
- = ASSERT2( isId bndr, ppr bndr )
- isStrictDmd (idNewDemandInfo bndr) || isStrictType (idType bndr)
-\end{code}
-
%************************************************************************
%* *
\subsubsection{The @SimplEnv@ type}
classifyFF :: CoreBind -> FloatFlag
classifyFF (Rec _) = FltLifted
classifyFF (NonRec bndr rhs)
- | not (isStrictBndr bndr) = FltLifted
+ | not (isStrictId bndr) = FltLifted
| exprOkForSpeculation rhs = FltOkSpec
| otherwise = FltCareful
-> (SimplEnv, OutBndr)
-- C.f. substIdBndr above
-- Clone Id if necessary, substitute its type
--- Return an Id with completely zapped IdInfo
+-- Return an Id with its fragile info zapped
+-- namely, any info that depends on free variables
-- [addLetIdInfo, below, will restore its IdInfo]
+-- We want to retain robust info, especially arity and demand info,
+-- so that they are available to occurrences that occur in an
+-- earlier binding of a letrec
-- Augment the subtitution
-- if the unique changed, *or*
-- if there's interesting occurrence info
where
id1 = uniqAway in_scope old_id
id2 = substIdType env id1
- -- we want to get rid of any info that's dependent on free variables,
+
+ -- We want to get rid of any info that's dependent on free variables,
-- but keep other info (like the arity).
new_id = zapFragileIdInfo id2