[commit: ghc] master: Disentangle postProcessDmdTypeM and postProcessUnsat (72b6224)
git at git.haskell.org
git at git.haskell.org
Mon Dec 16 21:09:47 UTC 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/72b62242288d23299d77245faed8c5fc4dab1d4f/ghc
>---------------------------------------------------------------
commit 72b62242288d23299d77245faed8c5fc4dab1d4f
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.)
>---------------------------------------------------------------
72b62242288d23299d77245faed8c5fc4dab1d4f
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 f44437d..3281332 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