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

git at git.haskell.org git at git.haskell.org
Mon Dec 16 20:59:17 UTC 2013


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

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

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

commit 919ae137eaf79d938d6321bc83bc5ca950c6df0c
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.)


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

919ae137eaf79d938d6321bc83bc5ca950c6df0c
 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