Add comments, plus fix zapFragileInfo to zap worker info
authorsimonpj@microsoft.com <unknown>
Mon, 11 Dec 2006 16:51:41 +0000 (16:51 +0000)
committersimonpj@microsoft.com <unknown>
Mon, 11 Dec 2006 16:51:41 +0000 (16:51 +0000)
This is a minor fix up to the patch
 * retain arity for let-bound vars in simplifier

compiler/basicTypes/IdInfo.lhs
compiler/simplCore/SimplEnv.lhs

index 9b39ccb..3261adf 100644 (file)
@@ -702,7 +702,9 @@ zapDemandInfo info@(IdInfo {newDemandInfo = dmd})
 
 \begin{code}
 zapFragileInfo :: IdInfo -> Maybe IdInfo
 
 \begin{code}
 zapFragileInfo :: IdInfo -> Maybe IdInfo
+-- Zap info that depends on free variables
 zapFragileInfo info = Just (info `setSpecInfo` emptySpecInfo
 zapFragileInfo info = Just (info `setSpecInfo` emptySpecInfo
+                                `setWorkerInfo` NoWorker
                                  `setUnfoldingInfo` NoUnfolding)
 \end{code}
 
                                  `setUnfoldingInfo` NoUnfolding)
 \end{code}
 
index 040240c..245f313 100644 (file)
@@ -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
               -> (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]
 --     [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
 -- 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
   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
 
     -- but keep other info (like the arity).
     new_id = zapFragileIdInfo id2