summaryrefslogtreecommitdiff
path: root/compiler/coreSyn
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2013-02-13 08:52:06 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2013-02-13 08:52:06 +0000
commitf525c0b242816abe26c6b5f81b8d677fd595bebd (patch)
tree30c02e4292c4a91edfd83ee6f7f05bce3d1ee2ec /compiler/coreSyn
parent24ec956e25a9ae15d33d0c38262d227fba57ec8c (diff)
downloadhaskell-f525c0b242816abe26c6b5f81b8d677fd595bebd.tar.gz
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.
Diffstat (limited to 'compiler/coreSyn')
-rw-r--r--compiler/coreSyn/CoreUtils.lhs6
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/coreSyn/CoreUtils.lhs b/compiler/coreSyn/CoreUtils.lhs
index 6726087bee..4e45da4b4b 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 }