From dbcff8ab57f64bcc6abff68448fc33691410266e Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Mon, 11 Dec 2006 16:51:41 +0000 Subject: [PATCH] Add comments, plus fix zapFragileInfo to zap worker info This is a minor fix up to the patch * retain arity for let-bound vars in simplifier --- compiler/basicTypes/IdInfo.lhs | 2 ++ compiler/simplCore/SimplEnv.lhs | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/basicTypes/IdInfo.lhs b/compiler/basicTypes/IdInfo.lhs index 9b39ccb..3261adf 100644 --- a/compiler/basicTypes/IdInfo.lhs +++ b/compiler/basicTypes/IdInfo.lhs @@ -702,7 +702,9 @@ 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) \end{code} diff --git a/compiler/simplCore/SimplEnv.lhs b/compiler/simplCore/SimplEnv.lhs index 040240c..245f313 100644 --- a/compiler/simplCore/SimplEnv.lhs +++ b/compiler/simplCore/SimplEnv.lhs @@ -608,8 +608,12 @@ substLetIdBndr :: SimplEnv -> InBndr -- Env and binder to transform -> (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 @@ -620,7 +624,8 @@ substLetIdBndr env@(SimplEnv { seInScope = in_scope, seIdSubst = id_subst }) old 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 -- 1.7.10.4