diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2020-12-16 12:48:52 +0000 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-12-19 02:14:42 -0500 |
commit | 173112cad82630b02eb91acb1f5fb91a96fa02b9 (patch) | |
tree | c9a154eb05c3189bc53ecf6569b869db6fdce342 /testsuite/tests | |
parent | c2430398481f5aab12fd94e6549c7b9bbd1e43fe (diff) | |
download | haskell-173112cad82630b02eb91acb1f5fb91a96fa02b9.tar.gz |
Make noinline more reliable
This patch makes the desugarer rewrite
noinline (f d) --> noinline f d
This makes 'noinline' much more reliable: see #18995
It's explained in the improved Note [noinlineId magic]
in GHC.Types.Id.Make
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T18995.hs | 6 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T18995.stderr | 66 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/all.T | 2 |
3 files changed, 73 insertions, 1 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T18995.hs b/testsuite/tests/simplCore/should_compile/T18995.hs new file mode 100644 index 0000000000..052a03ea98 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T18995.hs @@ -0,0 +1,6 @@ +module T18995 where + +import GHC.Magic ( noinline ) + +foo :: IO () +foo = (noinline print) True diff --git a/testsuite/tests/simplCore/should_compile/T18995.stderr b/testsuite/tests/simplCore/should_compile/T18995.stderr new file mode 100644 index 0000000000..a1db26f6ec --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T18995.stderr @@ -0,0 +1,66 @@ + +==================== Tidy Core ==================== +Result size of Tidy Core + = {terms: 19, types: 14, coercions: 12, joins: 0/0} + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T18995.$trModule4 :: GHC.Prim.Addr# +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}] +T18995.$trModule4 = "main"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T18995.$trModule3 :: GHC.Types.TrName +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] +T18995.$trModule3 = GHC.Types.TrNameS T18995.$trModule4 + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T18995.$trModule2 :: GHC.Prim.Addr# +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}] +T18995.$trModule2 = "T18995"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T18995.$trModule1 :: GHC.Types.TrName +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] +T18995.$trModule1 = GHC.Types.TrNameS T18995.$trModule2 + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +T18995.$trModule :: GHC.Types.Module +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] +T18995.$trModule + = GHC.Types.Module T18995.$trModule3 T18995.$trModule1 + +-- RHS size: {terms: 4, types: 7, coercions: 12, joins: 0/0} +foo :: IO () +[GblId, + Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, + WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 40 0}] +foo + = noinline + @(forall a. Show a => a -> IO ()) + (System.IO.print1 + `cast` (forall (a :: <*>_N). + <Show a>_R + %<'Many>_N ->_R <a>_R + %<'Many>_N ->_R Sym (GHC.Types.N:IO[0] <()>_R) + :: (forall {a}. + Show a => + a + -> GHC.Prim.State# GHC.Prim.RealWorld + -> (# GHC.Prim.State# GHC.Prim.RealWorld, () #)) + ~R# (forall {a}. Show a => a -> IO ()))) + @Bool + GHC.Show.$fShowBool + GHC.Types.True + + + diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 76f9567f3d..3bfc8c5c09 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -341,4 +341,4 @@ test('T18649', normal, compile, ['-O -ddump-rules -Wno-simplifiable-class-constr test('T18747A', normal, compile, ['']) test('T18747B', normal, compile, ['']) test('T18815', only_ways(['optasm']), makefile_test, ['T18815']) - +test('T18995', [ grep_errmsg(r'print') ], compile, ['-O -ddump-simpl -dsuppress-uniques']) |