[commit: ghc] wip/T13861: WIP: create DEFAULT when more than two alts give binder (f6216f9)

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


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

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

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

commit f6216f98555ef3e1ed2e5f05068da3399be9579f
Author: Gabor Greif <ggreif at gmail.com>
Date:   Fri Dec 29 11:46:20 2017 +0100

    WIP: create DEFAULT when more than two alts give binder


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

f6216f98555ef3e1ed2e5f05068da3399be9579f
 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 0fab9f2..7ca74ec 100644
--- a/compiler/simplStg/StgCse.hs
+++ b/compiler/simplStg/StgCse.hs
@@ -95,6 +95,8 @@ import Name (NamedThing (..), mkFCallName)
 import Unique (mkUniqueGrimily, getKey, getUnique)
 import TyCon (tyConFamilySize)
 
+import Data.List (partition)
+
 --------------
 -- The Trie --
 --------------
@@ -418,7 +420,8 @@ mkStgCase scrut bndr ty alts | all isBndr alts = scrut
     isBndr (_, _, StgApp f []) = f == bndr
     isBndr _                   = False
     -- see Note [Lumping alternatives together]
-    grouped alts | any isBndr alts = pprTrace "mkStgCase" (ppr alts) Nothing
+    grouped ((DEFAULT, _, _) : alts) | any isBndr alts = pprTrace "mkStgCaseDEFAULT" (ppr alts) Nothing
+    grouped alts | (bs@(_:_:_),rest) <- partition isBndr alts = pprTrace "mkStgCase" (ppr bs) $ Just ((DEFAULT, []{-FIXME-}, StgApp bndr []) : rest)
     grouped _ = Nothing
 
 -- Utilities



More information about the ghc-commits mailing list