summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2016-08-30 16:55:58 -0400
committerBen Gamari <ben@smart-cactus.org>2016-08-30 17:50:50 -0400
commit83b326cda759cfd4c538595cf38ee23eb81a4c76 (patch)
treebb55adf5b8dbcf2795ffcd303d66c2bad29c8aed /testsuite
parent6781f37d1915ab08cdb3846839a1d485a874049b (diff)
downloadhaskell-83b326cda759cfd4c538595cf38ee23eb81a4c76.tar.gz
Fix binary-trees regression from unnecessary floating in CorePrep.
In the previous patch, I handled lazy @(Int -> Int) f x correctly, but failed to handle lazy @Int (f x) (we need to collect arguments in f x). Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: validate Reviewers: simonpj, austin, bgamari, nomeata Reviewed By: nomeata Subscribers: simonmar, thomie Differential Revision: https://phabricator.haskell.org/D2471
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T1
-rw-r--r--testsuite/tests/simplCore/should_compile/par01.hs10
-rw-r--r--testsuite/tests/simplCore/should_compile/par01.stderr33
3 files changed, 44 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 92f9af4797..e2e0bb6c31 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -243,3 +243,4 @@ test('T12076sat', normal, compile, ['-O'])
test('T12212', normal, compile, ['-O'])
test('noinline01', only_ways(['optasm']), compile, ['-ddump-stg -dsuppress-uniques -O'])
+test('par01', only_ways(['optasm']), compile, ['-ddump-prep -dsuppress-uniques -O2'])
diff --git a/testsuite/tests/simplCore/should_compile/par01.hs b/testsuite/tests/simplCore/should_compile/par01.hs
new file mode 100644
index 0000000000..e67fb13a4b
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/par01.hs
@@ -0,0 +1,10 @@
+module Par01 where
+
+import GHC.Conc
+
+-- The smoking gun in -ddump-prep is:
+-- case Par01.depth d of sat { __DEFAULT -> sat }
+-- this should never happen!
+
+depth :: Int -> Int
+depth d = d `par` depth d
diff --git a/testsuite/tests/simplCore/should_compile/par01.stderr b/testsuite/tests/simplCore/should_compile/par01.stderr
new file mode 100644
index 0000000000..90d467f71c
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/par01.stderr
@@ -0,0 +1,33 @@
+
+==================== CorePrep ====================
+Result size of CorePrep = {terms: 18, types: 8, coercions: 0}
+
+Rec {
+-- RHS size: {terms: 7, types: 3, coercions: 0}
+Par01.depth [Occ=LoopBreaker] :: GHC.Types.Int -> GHC.Types.Int
+[GblId, Arity=1, Caf=NoCafRefs, Str=<L,U>, Unf=OtherCon []]
+Par01.depth =
+ \ (d :: GHC.Types.Int) ->
+ case GHC.Prim.par# @ GHC.Types.Int d of { __DEFAULT ->
+ Par01.depth d
+ }
+end Rec }
+
+-- RHS size: {terms: 2, types: 0, coercions: 0}
+Par01.$trModule2 :: GHC.Types.TrName
+[GblId, Caf=NoCafRefs, Str=m1, Unf=OtherCon []]
+Par01.$trModule2 = GHC.Types.TrNameS "main"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0}
+Par01.$trModule1 :: GHC.Types.TrName
+[GblId, Caf=NoCafRefs, Str=m1, Unf=OtherCon []]
+Par01.$trModule1 = GHC.Types.TrNameS "Par01"#
+
+-- RHS size: {terms: 3, types: 0, coercions: 0}
+Par01.$trModule :: GHC.Types.Module
+[GblId, Caf=NoCafRefs, Str=m, Unf=OtherCon []]
+Par01.$trModule =
+ GHC.Types.Module Par01.$trModule2 Par01.$trModule1
+
+
+