[commit: ghc] wip/nested-cpr: CPR test case: Case binder CPR (4644cd9)

git at git.haskell.org git at git.haskell.org
Fri Jan 17 23:50:18 UTC 2014


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

On branch  : wip/nested-cpr
Link       : http://ghc.haskell.org/trac/ghc/changeset/4644cd986ecf08108e21e5fc9b4a859870645aa4/ghc

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

commit 4644cd986ecf08108e21e5fc9b4a859870645aa4
Author: Joachim Breitner <mail at joachim-breitner.de>
Date:   Tue Jan 14 09:36:34 2014 +0000

    CPR test case: Case binder CPR


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

4644cd986ecf08108e21e5fc9b4a859870645aa4
 testsuite/tests/stranal/sigs/CaseBinderCPR.hs           |   15 +++++++++++++++
 .../sigs/{FacState.stderr => CaseBinderCPR.stderr}      |    2 +-
 testsuite/tests/stranal/sigs/all.T                      |    1 +
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/testsuite/tests/stranal/sigs/CaseBinderCPR.hs b/testsuite/tests/stranal/sigs/CaseBinderCPR.hs
new file mode 100644
index 0000000..13f2163
--- /dev/null
+++ b/testsuite/tests/stranal/sigs/CaseBinderCPR.hs
@@ -0,0 +1,15 @@
+module CaseBinderCPR where
+
+-- This example, taken from nofib's transform (and heavily reduced) ensures that
+-- CPR information is added to a case binder
+
+f_list_cmp::(t1 -> t1 -> Int) -> [t1] -> [t1] -> Int;
+f_list_cmp a_cmp [] []= 0
+f_list_cmp a_cmp [] a_ys= -1
+f_list_cmp a_cmp a_xs []= 1
+f_list_cmp a_cmp (a_x:a_xs) (a_y:a_ys)=
+    if r_order == 0
+    then f_list_cmp a_cmp a_xs a_ys
+    else r_order
+  where
+    r_order = a_cmp a_x a_y
diff --git a/testsuite/tests/stranal/sigs/FacState.stderr b/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr
similarity index 53%
copy from testsuite/tests/stranal/sigs/FacState.stderr
copy to testsuite/tests/stranal/sigs/CaseBinderCPR.stderr
index 133ad6e..f2ea61d 100644
--- a/testsuite/tests/stranal/sigs/FacState.stderr
+++ b/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr
@@ -1,5 +1,5 @@
 
 ==================== Strictness signatures ====================
-FacState.fac: <S,1*U(U)><L,U>dm1(d,tm1(d))
+CaseBinderCPR.f_list_cmp: <L,C(C1(U(U)))><S,1*U><S,1*U>m()
 
 
diff --git a/testsuite/tests/stranal/sigs/all.T b/testsuite/tests/stranal/sigs/all.T
index 3657432..3e271c5 100644
--- a/testsuite/tests/stranal/sigs/all.T
+++ b/testsuite/tests/stranal/sigs/all.T
@@ -13,3 +13,4 @@ test('HyperStrUse', normal, compile, [''])
 test('T8598', normal, compile, [''])
 test('FacState', expect_broken(1600), compile, [''])
 test('UnsatFun', normal, compile, [''])
+test('CaseBinderCPR', normal, compile, [''])



More information about the ghc-commits mailing list