diff options
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/cpranal/sigs/CaseBinderCPR.hs (renamed from testsuite/tests/stranal/sigs/CaseBinderCPR.hs) | 6 | ||||
-rw-r--r-- | testsuite/tests/cpranal/sigs/CaseBinderCPR.stderr | 7 | ||||
-rw-r--r-- | testsuite/tests/cpranal/sigs/Makefile | 3 | ||||
-rw-r--r-- | testsuite/tests/cpranal/sigs/T19232.hs | 14 | ||||
-rw-r--r-- | testsuite/tests/cpranal/sigs/T19232.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/cpranal/sigs/all.T | 9 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/CaseBinderCPR.stderr | 18 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/all.T | 1 |
8 files changed, 45 insertions, 19 deletions
diff --git a/testsuite/tests/stranal/sigs/CaseBinderCPR.hs b/testsuite/tests/cpranal/sigs/CaseBinderCPR.hs index 13f216347d..1310031f42 100644 --- a/testsuite/tests/stranal/sigs/CaseBinderCPR.hs +++ b/testsuite/tests/cpranal/sigs/CaseBinderCPR.hs @@ -13,3 +13,9 @@ f_list_cmp a_cmp (a_x:a_xs) (a_y:a_ys)= else r_order where r_order = a_cmp a_x a_y + + +-- But not every case binder has the CPR property. +-- x below does not and we should not CPR nestedly for it: +g :: [Int] -> (Int, Int) +g xs = let x = xs !! 0 in x `seq` (x, x) diff --git a/testsuite/tests/cpranal/sigs/CaseBinderCPR.stderr b/testsuite/tests/cpranal/sigs/CaseBinderCPR.stderr new file mode 100644 index 0000000000..7f98fe0612 --- /dev/null +++ b/testsuite/tests/cpranal/sigs/CaseBinderCPR.stderr @@ -0,0 +1,7 @@ + +==================== Cpr signatures ==================== +CaseBinderCPR.$trModule: +CaseBinderCPR.f_list_cmp: +CaseBinderCPR.g: m1 + + diff --git a/testsuite/tests/cpranal/sigs/Makefile b/testsuite/tests/cpranal/sigs/Makefile new file mode 100644 index 0000000000..9101fbd40a --- /dev/null +++ b/testsuite/tests/cpranal/sigs/Makefile @@ -0,0 +1,3 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk diff --git a/testsuite/tests/cpranal/sigs/T19232.hs b/testsuite/tests/cpranal/sigs/T19232.hs new file mode 100644 index 0000000000..3ea087d585 --- /dev/null +++ b/testsuite/tests/cpranal/sigs/T19232.hs @@ -0,0 +1,14 @@ +module T19232 where + +-- | `x` is not used strictly and hence will not be available unboxed, so +-- the `otherwise` RHS does not have the CPR property, even if it returns +-- a case binder. +f :: Bool -> Int -> Int +f True x + | x == 3 = 8 + | otherwise = x -- NB: the condition was flipped so that we can't substitute `x` for a constant here +f False _ = 3 +{-# NOINLINE f #-} + +-- See also test CaseBinderCPR + diff --git a/testsuite/tests/cpranal/sigs/T19232.stderr b/testsuite/tests/cpranal/sigs/T19232.stderr new file mode 100644 index 0000000000..3aa701833b --- /dev/null +++ b/testsuite/tests/cpranal/sigs/T19232.stderr @@ -0,0 +1,6 @@ + +==================== Cpr signatures ==================== +T19232.$trModule: +T19232.f: + + diff --git a/testsuite/tests/cpranal/sigs/all.T b/testsuite/tests/cpranal/sigs/all.T new file mode 100644 index 0000000000..f5ac233a8c --- /dev/null +++ b/testsuite/tests/cpranal/sigs/all.T @@ -0,0 +1,9 @@ +# We are testing the result of an optimization, so no use +# running them in various runtimes +setTestOpts(only_ways(['optasm'])) +# This directory contains tests where we annotate functions with expected +# CPR signatures, and verify that these are actually those found by the compiler +setTestOpts(extra_hc_opts('-ddump-cpr-signatures')) + +test('CaseBinderCPR', normal, compile, ['']) +test('T19232', normal, compile, ['']) diff --git a/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr b/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr deleted file mode 100644 index ca6d3015ff..0000000000 --- a/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr +++ /dev/null @@ -1,18 +0,0 @@ - -==================== Strictness signatures ==================== -CaseBinderCPR.$trModule: -CaseBinderCPR.f_list_cmp: <UCU(CS(P(MU)))><SU><SU> - - - -==================== Cpr signatures ==================== -CaseBinderCPR.$trModule: -CaseBinderCPR.f_list_cmp: m1 - - - -==================== Strictness signatures ==================== -CaseBinderCPR.$trModule: -CaseBinderCPR.f_list_cmp: <UCU(CS(P(SU)))><SU><SU> - - diff --git a/testsuite/tests/stranal/sigs/all.T b/testsuite/tests/stranal/sigs/all.T index 07cc815823..5d562a6a8c 100644 --- a/testsuite/tests/stranal/sigs/all.T +++ b/testsuite/tests/stranal/sigs/all.T @@ -16,7 +16,6 @@ test('UnsatFun', normal, compile, ['']) test('BottomFromInnerLambda', normal, compile, ['']) test('DmdAnalGADTs', normal, compile, ['']) test('T12370', normal, compile, ['']) -test('CaseBinderCPR', normal, compile, ['']) test('NewtypeArity', normal, compile, ['']) test('T5075', normal, compile, ['']) test('T17932', normal, compile, ['']) |