summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2013-01-02 16:48:47 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2013-01-02 16:48:47 +0000
commit8f01d1e494edfe94810d73705e61acb0d1e695c2 (patch)
tree47e4e5b038b107f5b9fba3f1bd9e320ac2f45dd5
parentd056bb324ed633a34fc51bc417abd0e0cf1c12fc (diff)
downloadhaskell-8f01d1e494edfe94810d73705e61acb0d1e695c2.tar.gz
Test Trac #7360
-rw-r--r--testsuite/tests/simplCore/should_compile/T7360.hs16
-rw-r--r--testsuite/tests/simplCore/should_compile/T7360.stderr47
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T2
3 files changed, 64 insertions, 1 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T7360.hs b/testsuite/tests/simplCore/should_compile/T7360.hs
new file mode 100644
index 0000000000..b877da6a0d
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T7360.hs
@@ -0,0 +1,16 @@
+-- Both these functions should successfully simplify
+-- using the combine-identical-alterantives optimisation
+
+module T7360 where
+
+data Foo = Foo1 | Foo2 | Foo3 !Int
+
+fun1 :: Foo -> ()
+fun1 x = case x of
+ Foo1 -> ()
+ Foo2 -> ()
+ Foo3 {} -> ()
+
+fun2 x = case x of
+ [] -> length x
+ (_:_) -> length x
diff --git a/testsuite/tests/simplCore/should_compile/T7360.stderr b/testsuite/tests/simplCore/should_compile/T7360.stderr
new file mode 100644
index 0000000000..5cc46cb80f
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T7360.stderr
@@ -0,0 +1,47 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core = {terms: 20, types: 17, coercions: 0}
+
+T7360.$WFoo3 [InlPrag=INLINE] :: GHC.Types.Int -> T7360.Foo
+[GblId[DataConWrapper],
+ Arity=1,
+ Caf=NoCafRefs,
+ Str=DmdType S,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True,
+ ConLike=True, WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(unsat_ok=False,boring_ok=False)
+ Tmpl= \ (dt [Occ=Once] :: GHC.Types.Int) ->
+ case dt of dt { __DEFAULT -> T7360.Foo3 dt }}]
+T7360.$WFoo3 =
+ \ (dt [Occ=Once] :: GHC.Types.Int) ->
+ case dt of dt { __DEFAULT -> T7360.Foo3 dt }
+
+T7360.fun1 :: T7360.Foo -> ()
+[GblId,
+ Arity=1,
+ Caf=NoCafRefs,
+ Str=DmdType S,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=1, Value=True,
+ ConLike=True, WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=True)}]
+T7360.fun1 =
+ \ (x :: T7360.Foo) -> case x of _ { __DEFAULT -> GHC.Tuple.() }
+
+T7360.fun2 :: forall a. [a] -> GHC.Types.Int
+[GblId,
+ Arity=1,
+ Caf=NoCafRefs,
+ Str=DmdType Sm,
+ Unf=Unf{Src=InlineStable, TopLvl=True, Arity=1, Value=True,
+ ConLike=True, WorkFree=True, Expandable=True,
+ Guidance=ALWAYS_IF(unsat_ok=True,boring_ok=False)
+ Tmpl= \ (@ a) (x [Occ=Once] :: [a]) ->
+ case GHC.List.$wlen @ a x 0 of ww { __DEFAULT ->
+ GHC.Types.I# ww
+ }}]
+T7360.fun2 =
+ \ (@ a) (x :: [a]) ->
+ case GHC.List.$wlen @ a x 0 of ww { __DEFAULT -> GHC.Types.I# ww }
+
+
+
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 7c7138dbd7..b25e25b421 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -155,4 +155,4 @@ test('T7165',
run_command,
['$MAKE -s --no-print-directory T7165'])
test('T7287', normal, compile, [''])
-
+test('T7360', only_ways(['optasm']), compile, ['-ddump-simpl -dsuppress-uniques'])