[commit: ghc] master: Charge 1 for each case alternative in exprStats (f525c0b)

Simon Peyton Jones simonpj at microsoft.com
Wed Feb 13 17:55:07 CET 2013


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/f525c0b242816abe26c6b5f81b8d677fd595bebd

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

commit f525c0b242816abe26c6b5f81b8d677fd595bebd
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date:   Wed Feb 13 08:52:06 2013 +0000

    Charge 1 for each case alternative in exprStats
    
    This doesn't affect inlining, only the stats reported by -dshow-passes.
    But we were getting un-naturally small numbers for some big case expressions.

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

 compiler/coreSyn/CoreUtils.lhs |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/compiler/coreSyn/CoreUtils.lhs b/compiler/coreSyn/CoreUtils.lhs
index 6726087..4e45da4 100644
--- a/compiler/coreSyn/CoreUtils.lhs
+++ b/compiler/coreSyn/CoreUtils.lhs
@@ -1456,7 +1456,11 @@ exprStats (Cast e co)     = coStats co `plusCS` exprStats e
 exprStats (Tick _ e)      = exprStats e
 
 altStats :: CoreAlt -> CoreStats
-altStats (_, bs, r) = sumCS bndrStats bs `plusCS` exprStats r
+altStats (_, bs, r) = altBndrStats bs `plusCS` exprStats r
+
+altBndrStats :: [Var] -> CoreStats
+-- Charge one for the alternative, not for each binder
+altBndrStats vs = oneTM `plusCS` sumCS (tyStats . varType) vs
 
 tyStats :: Type -> CoreStats
 tyStats ty = zeroCS { cs_ty = typeSize ty }





More information about the ghc-commits mailing list