Commit 2e3b6bd7 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Remove uses of addFreeTyVars

This optimisation actually make things a bit slower on average, as
measured by nofib. The example in #1136 in particular suffers from high
memory usage. Therefore we no longer do the optimisation.
parent 57505177
......@@ -138,13 +138,13 @@ where it can easily be found.
\begin{code}
mkLocalIdWithInfo :: Name -> Type -> IdInfo -> Id
mkLocalIdWithInfo name ty info = Var.mkLocalId name (addFreeTyVars ty) info
mkLocalIdWithInfo name ty info = Var.mkLocalId name ty info
mkExportedLocalId :: Name -> Type -> Id
mkExportedLocalId name ty = Var.mkExportedLocalId name (addFreeTyVars ty) vanillaIdInfo
mkExportedLocalId name ty = Var.mkExportedLocalId name ty vanillaIdInfo
mkGlobalId :: GlobalIdDetails -> Name -> Type -> IdInfo -> Id
mkGlobalId details name ty info = Var.mkGlobalId details name (addFreeTyVars ty) info
mkGlobalId details name ty info = Var.mkGlobalId details name ty info
\end{code}
\begin{code}
......@@ -202,7 +202,7 @@ mkTemplateLocal i ty = mkSysLocal FSLIT("tpl") (mkBuiltinUnique i) ty
\begin{code}
setIdType :: Id -> Type -> Id
-- Add free tyvar info to the type
setIdType id ty = seqType ty `seq` Var.setIdType id (addFreeTyVars ty)
setIdType id ty = seqType ty `seq` Var.setIdType id ty
idPrimRep :: Id -> PrimRep
idPrimRep id = typePrimRep (idType id)
......
......@@ -72,7 +72,7 @@ module Type (
-- Free variables
tyVarsOfType, tyVarsOfTypes, tyVarsOfPred, tyVarsOfTheta,
typeKind, addFreeTyVars,
typeKind,
-- Type families
tyFamInsts,
......@@ -748,11 +748,6 @@ tyVarsOfPred (EqPred ty1 ty2) = tyVarsOfType ty1 `unionVarSet` tyVarsOfType ty2
tyVarsOfTheta :: ThetaType -> TyVarSet
tyVarsOfTheta = foldr (unionVarSet . tyVarsOfPred) emptyVarSet
-- Add a Note with the free tyvars to the top of the type
addFreeTyVars :: Type -> Type
addFreeTyVars ty@(NoteTy (FTVNote _) _) = ty
addFreeTyVars ty = NoteTy (FTVNote (tyVarsOfType ty)) ty
\end{code}
......
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