[commit: ghc] wip/T13861: WIP: detect lumping opportunities (5478046)

git at git.haskell.org git at git.haskell.org
Fri Dec 29 12:28:09 UTC 2017


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

On branch  : wip/T13861
Link       : http://ghc.haskell.org/trac/ghc/changeset/547804604206554cf6b0e532f5d9e0659149021c/ghc

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

commit 547804604206554cf6b0e532f5d9e0659149021c
Author: Gabor Greif <ggreif at gmail.com>
Date:   Fri Dec 29 11:26:31 2017 +0100

    WIP: detect lumping opportunities


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

547804604206554cf6b0e532f5d9e0659149021c
 compiler/simplStg/StgCse.hs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/compiler/simplStg/StgCse.hs b/compiler/simplStg/StgCse.hs
index 82a36d5..0fab9f2 100644
--- a/compiler/simplStg/StgCse.hs
+++ b/compiler/simplStg/StgCse.hs
@@ -410,13 +410,16 @@ stgCseRhs env bndr (StgRhsClosure ccs info occs upd args body)
 
 mkStgCase :: StgExpr -> OutId -> AltType -> [StgAlt] -> StgExpr
 mkStgCase scrut bndr ty alts | all isBndr alts = scrut
+                             | Just alts' <- grouped alts = StgCase scrut bndr ty alts'
                              | otherwise       = StgCase scrut bndr ty alts
 
   where
     -- see Note [All alternatives are the binder]
     isBndr (_, _, StgApp f []) = f == bndr
     isBndr _                   = False
-
+    -- see Note [Lumping alternatives together]
+    grouped alts | any isBndr alts = pprTrace "mkStgCase" (ppr alts) Nothing
+    grouped _ = Nothing
 
 -- Utilities
 



More information about the ghc-commits mailing list