summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorKrzysztof Gogolewski <krzysztof.gogolewski@tweag.io>2023-04-21 11:37:42 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-05-12 06:11:38 -0400
commitab63daac0e0ed8749514e38d714cfcd4562f4326 (patch)
treea8914398a67f2be5a8025a3949fee98ed0e5685c /testsuite
parentc176ad1835ccfe55e2bde875b4a35e9d226ff657 (diff)
downloadhaskell-ab63daac0e0ed8749514e38d714cfcd4562f4326.tar.gz
Allow Core optimizations when interpreting bytecode
Tracking ticket: #23056 MR: !10399 This adds the flag `-funoptimized-core-for-interpreter`, permitting use of the `-O` flag to enable optimizations when compiling with the interpreter backend, like in ghci.
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/driver/testlib.py2
-rw-r--r--testsuite/tests/simplCore/should_compile/T23267.hs25
-rw-r--r--testsuite/tests/simplCore/should_compile/T23267.script1
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T1
-rw-r--r--testsuite/tests/simplCore/should_run/T23056.hs10
-rw-r--r--testsuite/tests/simplCore/should_run/T23056.script2
-rw-r--r--testsuite/tests/simplCore/should_run/T23056.stdout1
-rw-r--r--testsuite/tests/simplCore/should_run/all.T1
8 files changed, 42 insertions, 1 deletions
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 09ab06d469..b2353531c2 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -387,7 +387,7 @@ def expect_fail_for( ways: List[WayName] ):
def expect_broken( bug: IssueNumber ):
"""
- This test is a expected not to work due to the indicated issue number.
+ This test is expected not to work due to the indicated issue number.
"""
def helper( name: TestName, opts ):
record_broken(name, opts, bug)
diff --git a/testsuite/tests/simplCore/should_compile/T23267.hs b/testsuite/tests/simplCore/should_compile/T23267.hs
new file mode 100644
index 0000000000..02307cea5d
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T23267.hs
@@ -0,0 +1,25 @@
+module T23267 where
+
+data N = Z | S N
+
+union :: N -> ()
+union Z = ()
+union t = splitS t
+
+splitS :: N -> ()
+splitS Z = ()
+splitS (S l) = splitS l
+
+{- Results in this error:
+
+*** Core Lint errors : in result of SpecConstr ***
+T23267.hs:10:1: warning:
+ Out of scope: l_aBE :: N
+ [LclId]
+ In the RHS of $ssplitS_sJx :: N -> ()
+ In the body of lambda with binder sc_sJw :: N
+ Substitution: <InScope = {}
+ IdSubst = []
+ TvSubst = []
+ CvSubst = []>
+-}
diff --git a/testsuite/tests/simplCore/should_compile/T23267.script b/testsuite/tests/simplCore/should_compile/T23267.script
new file mode 100644
index 0000000000..75e8cf5aaf
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T23267.script
@@ -0,0 +1 @@
+:load T23267
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 90e67d81fe..ae48423fa0 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -477,3 +477,4 @@ test('T23012', normal, compile, ['-O'])
test('RewriteHigherOrderPatterns', normal, compile, ['-O -ddump-rule-rewrites -dsuppress-all -dsuppress-uniques'])
test('T23024', normal, multimod_compile, ['T23024', '-O -v0'])
test('T23026', normal, compile, ['-O'])
+test('T23267', [expect_broken(23267), only_ways(['ghci']), extra_hc_opts('-fno-unoptimized-core-for-interpreter -fspec-constr')], ghci_script, ['T23267.script'])
diff --git a/testsuite/tests/simplCore/should_run/T23056.hs b/testsuite/tests/simplCore/should_run/T23056.hs
new file mode 100644
index 0000000000..abf3d7a7be
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T23056.hs
@@ -0,0 +1,10 @@
+module Main where
+
+fun :: IO ()
+fun = pure ()
+{-# noinline fun #-}
+
+{-# rules "fun" fun = putStrLn "fun" #-}
+
+main :: IO ()
+main = fun
diff --git a/testsuite/tests/simplCore/should_run/T23056.script b/testsuite/tests/simplCore/should_run/T23056.script
new file mode 100644
index 0000000000..fdf0d3b722
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T23056.script
@@ -0,0 +1,2 @@
+:load T23056
+main
diff --git a/testsuite/tests/simplCore/should_run/T23056.stdout b/testsuite/tests/simplCore/should_run/T23056.stdout
new file mode 100644
index 0000000000..3df46ad190
--- /dev/null
+++ b/testsuite/tests/simplCore/should_run/T23056.stdout
@@ -0,0 +1 @@
+fun
diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T
index 7348e1015a..bfd5fa6261 100644
--- a/testsuite/tests/simplCore/should_run/all.T
+++ b/testsuite/tests/simplCore/should_run/all.T
@@ -112,3 +112,4 @@ test('T22998', normal, compile_and_run, ['-O0 -fspecialise -dcore-lint'])
test('T23184', normal, compile_and_run, ['-O'])
test('T23134', normal, compile_and_run, ['-O0 -fcatch-nonexhaustive-cases'])
test('T23289', normal, compile_and_run, [''])
+test('T23056', [only_ways(['ghci']), extra_hc_opts('-fno-unoptimized-core-for-interpreter -O')], ghci_script, ['T23056.script'])