[commit: ghc] wip/T13861: test whether two STG equiv alts get joined (167f1b6)

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


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

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

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

commit 167f1b6badae1a6a8bc17d5202c3388657345b0a
Author: Gabor Greif <ggreif at gmail.com>
Date:   Fri Dec 29 09:37:03 2017 +0100

    test whether two STG equiv alts get joined


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

167f1b6badae1a6a8bc17d5202c3388657345b0a
 testsuite/tests/simplStg/should_run/T13861.hs     | 8 ++++++++
 testsuite/tests/simplStg/should_run/T13861.stdout | 1 +
 2 files changed, 9 insertions(+)

diff --git a/testsuite/tests/simplStg/should_run/T13861.hs b/testsuite/tests/simplStg/should_run/T13861.hs
index 9345a4a..6442dce 100644
--- a/testsuite/tests/simplStg/should_run/T13861.hs
+++ b/testsuite/tests/simplStg/should_run/T13861.hs
@@ -36,6 +36,12 @@ quux' Fal = True
 quux' _ = False
 {-# NOINLINE quux' #-}
 
+-- the 'Fal' and default case should be lumped together
+lump Fal = True
+lump Dunno = unsafeCoerce Tru
+lump _ = False
+{-# NOINLINE lump #-}
+
 
 nested :: Either Int (Either Int a) -> Either Bool (Maybe a)
 nested (Right (Right x)) = Right (Just x)
@@ -96,6 +102,8 @@ test x = do
     (same $! r52) $! r53                -- no, quux' is not STG identity on 'Tru'
     let (r54, r55) = (Fal, quux' r54)
     (same $! r54) $! r55                -- yes, quux' is STG identity on 'Fal'
+    let (r56, r57) = (Tru, lump r56)
+    (same $! r56) $! r57                -- yes, lump is STG identity on 'Tru'
 
     let (r4,_) = bar r1
     let r5 = nested r4
diff --git a/testsuite/tests/simplStg/should_run/T13861.stdout b/testsuite/tests/simplStg/should_run/T13861.stdout
index 2e3ae8c..7fd4e43 100644
--- a/testsuite/tests/simplStg/should_run/T13861.stdout
+++ b/testsuite/tests/simplStg/should_run/T13861.stdout
@@ -11,5 +11,6 @@ no
 yes
 yes
 yes
+yes
 no
 ("YAY","foo")



More information about the ghc-commits mailing list