[commit: ghc] wip/nested-cpr: More precisely recover [CPR for sum types] behaviour (6449837)

git at git.haskell.org git at git.haskell.org
Wed Dec 4 13:17:50 UTC 2013


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

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

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

commit 64498375b347186c0c146805b71305d75791e2be
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Wed Dec 4 12:11:09 2013 +0000

    More precisely recover [CPR for sum types] behaviour


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

64498375b347186c0c146805b71305d75791e2be
 compiler/stranal/DmdAnal.lhs |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/compiler/stranal/DmdAnal.lhs b/compiler/stranal/DmdAnal.lhs
index 3bb197b..686c4de 100644
--- a/compiler/stranal/DmdAnal.lhs
+++ b/compiler/stranal/DmdAnal.lhs
@@ -668,7 +668,8 @@ dmdAnalRhs top_lvl rec_flag env id rhs
     (lazy_fv, sig_fv) = splitFVs is_thunk rhs_fv1
 
     -- Note [CPR for sum types]
-    rhs_res' | is_sum_type || (is_thunk && not_strict) = forgetCPR rhs_res
+    rhs_res' | (is_sum_type && not (isTopLevel top_lvl)) ||
+               (is_thunk && not_strict)                = forgetCPR rhs_res
              | otherwise                               = rhs_res
         
     -- See Note [CPR for thunks]



More information about the ghc-commits mailing list