From 410fc617555117dd0ebbb3854f2d335628d60ea9 Mon Sep 17 00:00:00 2001 From: "simonpj@microsoft.com" Date: Fri, 5 Dec 2008 10:05:18 +0000 Subject: [PATCH] Make CoreTidy retain deadness info (better -ddump-simpl) GHC now retains more robust information about dead variables; but CoreTidy was throwing it away. This patch makes CoreTidy retain it, which gives better output for -ddump-simpl. New opportunity: shrink interface files by using wildcards for dead variables. --- compiler/coreSyn/CoreTidy.lhs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/compiler/coreSyn/CoreTidy.lhs b/compiler/coreSyn/CoreTidy.lhs index 3f84021..586f032 100644 --- a/compiler/coreSyn/CoreTidy.lhs +++ b/compiler/coreSyn/CoreTidy.lhs @@ -176,15 +176,21 @@ tidyIdBndr env@(tidy_env, var_env) id -- though we could extract it from the Id -- -- All nested Ids now have the same IdInfo, namely vanillaIdInfo, - -- which should save some space. + -- which should save some space; except that we hang onto dead-ness + -- (at the moment, solely to make printing tidy core nicer) -- But note that tidyLetBndr puts some of it back. - ty' = tidyType env (idType id) - id' = mkUserLocal occ' (idUnique id) ty' noSrcSpan - `setIdInfo` vanillaIdInfo - var_env' = extendVarEnv var_env id id' + ty' = tidyType env (idType id) + name' = mkInternalName (idUnique id) occ' noSrcSpan + id' = mkLocalIdWithInfo name' ty' new_info + var_env' = extendVarEnv var_env id id' + new_info | isDeadOcc (idOccInfo id) = deadIdInfo + | otherwise = vanillaIdInfo in ((tidy_env', var_env'), id') } + +deadIdInfo :: IdInfo +deadIdInfo = vanillaIdInfo `setOccInfo` IAmDead \end{code} \begin{code} -- 1.7.10.4