[commit: ghc] wip/nested-cpr: Disentangle postProcessDmdTypeM and postProcessUnsat (a2f9fb9)

git at git.haskell.org git at git.haskell.org
Sun Dec 15 16:23:31 UTC 2013


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nested-cpr
Link       : http://ghc.haskell.org/trac/ghc/changeset/a2f9fb99297cc8585b1b2af2bcfe8352bacce13f/ghc

>---------------------------------------------------------------

commit a2f9fb99297cc8585b1b2af2bcfe8352bacce13f
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Mon Dec 9 18:40:09 2013 +0000

    Disentangle postProcessDmdTypeM and postProcessUnsat
    
    Make different postProcess code paths for function arguments (which are
    post-processed just to be both'ed) and unsaturated functions (which are
    post-processed for other reasons.)


>---------------------------------------------------------------

a2f9fb99297cc8585b1b2af2bcfe8352bacce13f
 compiler/basicTypes/Demand.lhs |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/compiler/basicTypes/Demand.lhs b/compiler/basicTypes/Demand.lhs
index bb88e40..09b6f60 100644
--- a/compiler/basicTypes/Demand.lhs
+++ b/compiler/basicTypes/Demand.lhs
@@ -1131,7 +1131,19 @@ postProcessDmdTypeM Nothing   _  = nopDmdType
   -- Incoming demand was Absent, so just discard all usage information
   -- We only processed the thing at all to analyse the body
   -- See Note [Always analyse in virgin pass]
-postProcessDmdTypeM (Just du) ty = postProcessUnsat du ty
+postProcessDmdTypeM (Just du) (DmdType fv _ res_ty)
+    = DmdType (postProcessDmdEnv du fv) [] (postProcessDmdResult du res_ty)
+
+postProcessDmdResult :: DeferAndUse -> DmdResult -> DmdResult
+postProcessDmdResult (True,_)  r = topRes
+postProcessDmdResult (False,_) r = r
+
+postProcessDmdEnv :: DeferAndUse -> DmdEnv -> DmdEnv
+postProcessDmdEnv (True,  Many) env = deferReuseEnv env
+postProcessDmdEnv (False, Many) env = reuseEnv env
+postProcessDmdEnv (True,  One)  env = deferEnv env
+postProcessDmdEnv (False, One)  env = env
+
 
 postProcessUnsat :: DeferAndUse -> DmdType -> DmdType
 postProcessUnsat (True,  Many) ty = deferReuse ty



More information about the ghc-commits mailing list