summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2021-02-04 17:33:56 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-18 13:48:09 -0500
commit60ed2a65b22023a47c7215855e482cbe7a354f07 (patch)
treee3c63cc10ceb5d4823a7a1d14595af57295da4fc /testsuite
parenta4c53e3b00caacf5d103cf4f34017d932971ab67 (diff)
downloadhaskell-60ed2a65b22023a47c7215855e482cbe7a354f07.tar.gz
Improve specialisation for imported functions
At a SPECIALSE pragma for an imported Id, we used to check that it was marked INLINABLE. But that turns out to interact badly with worker/wrapper: see Note [Worker-wrapper for INLINABLE functions] in GHC.Core.Opt.WorkWrap. So this small patch instead simply tests that we have an unfolding for the function; see Note [SPECIALISE pragmas for imported Ids] in GHC.Tc.Gen.Sig. Fixes #19246
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/simplCore/should_compile/T19246.hs5
-rw-r--r--testsuite/tests/simplCore/should_compile/T19246.stderr11
-rw-r--r--testsuite/tests/simplCore/should_compile/T19246a.hs8
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T1
4 files changed, 25 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T19246.hs b/testsuite/tests/simplCore/should_compile/T19246.hs
new file mode 100644
index 0000000000..fba3f47b4f
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T19246.hs
@@ -0,0 +1,5 @@
+module T19246 where
+
+import T19246a
+
+{-# SPECIALISE f :: [Int] -> ([Int], Int) #-}
diff --git a/testsuite/tests/simplCore/should_compile/T19246.stderr b/testsuite/tests/simplCore/should_compile/T19246.stderr
new file mode 100644
index 0000000000..0c7894e56d
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T19246.stderr
@@ -0,0 +1,11 @@
+
+==================== Tidy Core rules ====================
+
+
+
+==================== Tidy Core rules ====================
+"SPEC f" [2] forall ($dOrd :: Ord Int). f @Int $dOrd = $sf
+"SPEC/T19246 $wf @Int" [2]
+ forall (w :: Ord Int). $wf @Int w = $s$wf
+
+
diff --git a/testsuite/tests/simplCore/should_compile/T19246a.hs b/testsuite/tests/simplCore/should_compile/T19246a.hs
new file mode 100644
index 0000000000..7a68ff2efa
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/T19246a.hs
@@ -0,0 +1,8 @@
+module T19246a where
+
+f :: Ord a => [a] -> ([a], a)
+{-# INLINABLE f #-}
+f xs = (ys, maximum ys)
+ where
+ ys = reverse . reverse . reverse . reverse . reverse . reverse $ xs
+
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index e892ad7194..b3936d11e6 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -345,3 +345,4 @@ test('T18815', only_ways(['optasm']), makefile_test, ['T18815'])
test('T18668', normal, compile, ['-dsuppress-uniques'])
test('T18995', [ grep_errmsg(r'print') ], compile, ['-O -ddump-simpl -dsuppress-uniques'])
test('T19168', normal, compile, [''])
+test('T19246', only_ways(['optasm']), multimod_compile, ['T19246', '-v0 -ddump-rules'])