From: Ian Lynagh Date: Sat, 15 Mar 2008 15:50:27 +0000 (+0000) Subject: Remove uses of addFreeTyVars X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=2e3b6bd7e00fa3faaa07ea0badee7f020a7c8306 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. --- diff --git a/compiler/basicTypes/Id.lhs b/compiler/basicTypes/Id.lhs index d8ae31d..cb2422d 100644 --- a/compiler/basicTypes/Id.lhs +++ b/compiler/basicTypes/Id.lhs @@ -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) diff --git a/compiler/types/Type.lhs b/compiler/types/Type.lhs index 9561c19..bddcdd1 100644 --- a/compiler/types/Type.lhs +++ b/compiler/types/Type.lhs @@ -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}