summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2021-01-07 18:35:29 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-01-10 23:34:59 -0500
commit1a220bcf704f6ce1404516a5b647246a20d34f6e (patch)
tree77250a8b8386ce3d6eb5e6f86f1cefabdd6269cd /testsuite/tests
parent4bb957de6e32722d04f47ddd57b6010dbc7770d2 (diff)
downloadhaskell-1a220bcf704f6ce1404516a5b647246a20d34f6e.tar.gz
WorkWrap: Use SysLocal Name for Thunk Splitting (#19180)
Since !4493 we annotate top-level bindings with demands, which leads to novel opportunities for thunk splitting absent top-level thunks. It turns out that thunk splitting wasn't quite equipped for that, because it re-used top-level, `External` Names for local helper Ids. That triggered a CoreLint error (#19180), reproducible with `T19180`. Fixed by adjusting the thunk splitting code to produce `SysLocal` names for the local bindings. Fixes #19180. Metric Decrease: T12227 T18282
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/stranal/should_compile/T19180.hs20
-rw-r--r--testsuite/tests/stranal/should_compile/all.T2
2 files changed, 22 insertions, 0 deletions
diff --git a/testsuite/tests/stranal/should_compile/T19180.hs b/testsuite/tests/stranal/should_compile/T19180.hs
new file mode 100644
index 0000000000..d0211ac4e3
--- /dev/null
+++ b/testsuite/tests/stranal/should_compile/T19180.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE ScopedTypeVariables #-}
+{-# LANGUAGE PolyKinds #-}
+module T14270 (mkTrApp) where
+
+import Data.Kind (Type)
+
+data TypeRep a = TypeRep
+
+mkTrApp :: TypeRep a -> TypeRep a
+mkTrApp (x :: TypeRep x)
+ | Just _ <- isTYPE (typeRepKind x)
+ = undefined
+mkTrApp x = TypeRep
+
+typeRepKind :: TypeRep (a :: k) -> TypeRep k
+typeRepKind = if sum [0..100] == 10 then undefined else const TypeRep
+
+isTYPE :: TypeRep (a :: Type) -> Maybe a
+isTYPE _ = if sum [0..100] == 10 then Nothing else undefined
+{-# NOINLINE isTYPE #-}
diff --git a/testsuite/tests/stranal/should_compile/all.T b/testsuite/tests/stranal/should_compile/all.T
index 28c8154a77..3e77a602ae 100644
--- a/testsuite/tests/stranal/should_compile/all.T
+++ b/testsuite/tests/stranal/should_compile/all.T
@@ -64,3 +64,5 @@ test('T18894', [ grep_errmsg(r'Dmd=\S+C\S+') ], compile, ['-ddump-stranal -dsup
test('T18894b', [ grep_errmsg(r'Arity=2') ], compile, ['-ddump-stranal -dsuppress-uniques -fno-call-arity -dppr-cols=200'])
# We care about the workers of f,g,h,i:
test('T18982', [ grep_errmsg(r'\$w. .*Int#$') ], compile, ['-dppr-cols=1000 -ddump-simpl -dsuppress-idinfo -dsuppress-uniques'])
+
+test('T19180', normal, compile, [''])