summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorTakano Akio <tak@anoak.io>2017-01-18 18:26:47 -0500
committerBen Gamari <ben@smart-cactus.org>2017-01-20 14:36:29 -0500
commitd49b2bb21691892ca6ac8f2403e31f2a5e53feb3 (patch)
treecc8488acf59467899e4d3279a340577eec95310f /testsuite
parenta2a67b77c3048713541d1ed96ec0b95fb2542f9a (diff)
downloadhaskell-d49b2bb21691892ca6ac8f2403e31f2a5e53feb3.tar.gz
Allow top-level string literals in Core (#8472)
This commits relaxes the invariants of the Core syntax so that a top-level variable can be bound to a primitive string literal of type Addr#. This commit: * Relaxes the invatiants of the Core, and allows top-level bindings whose type is Addr# as long as their RHS is either a primitive string literal or another variable. * Allows the simplifier and the full-laziness transformer to float out primitive string literals to the top leve. * Introduces the new StgGenTopBinding type to accomodate top-level Addr# bindings. * Introduces a new type of labels in the object code, with the suffix "_bytes", for exported top-level Addr# bindings. * Makes some built-in rules more robust. This was necessary to keep them functional after the above changes. This is a continuation of D2554. Rebasing notes: This had two slightly suspicious performance regressions: * T12425: bytes allocated regressed by roughly 5% * T4029: bytes allocated regressed by a bit over 1% * T13035: bytes allocated regressed by a bit over 5% These deserve additional investigation. Rebased by: bgamari. Test Plan: ./validate --slow Reviewers: goldfire, trofi, simonmar, simonpj, austin, hvr, bgamari Reviewed By: trofi, simonpj, bgamari Subscribers: trofi, simonpj, gridaphobe, thomie Differential Revision: https://phabricator.haskell.org/D2605 GHC Trac Issues: #8472
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/tests/deSugar/should_compile/T2431.stderr44
-rw-r--r--testsuite/tests/numeric/should_compile/T7116.stdout30
-rw-r--r--testsuite/tests/perf/compiler/all.T17
-rw-r--r--testsuite/tests/perf/should_run/T8472.hs19
-rw-r--r--testsuite/tests/perf/should_run/T8472.stdout1
-rw-r--r--testsuite/tests/perf/should_run/all.T8
-rw-r--r--testsuite/tests/perf/space_leaks/all.T3
-rw-r--r--testsuite/tests/roles/should_compile/Roles13.stderr66
-rw-r--r--testsuite/tests/simplCore/should_compile/Makefile5
-rw-r--r--testsuite/tests/simplCore/should_compile/T3234.stderr9
-rw-r--r--testsuite/tests/simplCore/should_compile/T3717.stderr30
-rw-r--r--testsuite/tests/simplCore/should_compile/T3772.stdout30
-rw-r--r--testsuite/tests/simplCore/should_compile/T4908.stderr30
-rw-r--r--testsuite/tests/simplCore/should_compile/T4930.stderr30
-rw-r--r--testsuite/tests/simplCore/should_compile/T7360.stderr86
-rw-r--r--testsuite/tests/simplCore/should_compile/T8274.stdout18
-rw-r--r--testsuite/tests/simplCore/should_compile/T9400.stderr22
-rw-r--r--testsuite/tests/simplCore/should_compile/all.T4
-rw-r--r--testsuite/tests/simplCore/should_compile/noinline01.stderr32
-rw-r--r--testsuite/tests/simplCore/should_compile/par01.stderr20
-rw-r--r--testsuite/tests/simplCore/should_compile/rule2.stderr4
-rw-r--r--testsuite/tests/simplCore/should_compile/spec-inline.stderr40
-rw-r--r--testsuite/tests/simplCore/should_compile/str-rules.hs20
-rw-r--r--testsuite/tests/simplCore/should_compile/str-rules.stdout3
24 files changed, 439 insertions, 132 deletions
diff --git a/testsuite/tests/deSugar/should_compile/T2431.stderr b/testsuite/tests/deSugar/should_compile/T2431.stderr
index 797c6c7776..a8da44b73f 100644
--- a/testsuite/tests/deSugar/should_compile/T2431.stderr
+++ b/testsuite/tests/deSugar/should_compile/T2431.stderr
@@ -1,6 +1,6 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 36, types: 30, coercions: 1}
+Result size of Tidy Core = {terms: 44, types: 34, coercions: 1}
-- RHS size: {terms: 2, types: 4, coercions: 1}
T2431.$WRefl [InlPrag=INLINE] :: forall a. a :~: a
@@ -21,25 +21,40 @@ absurd :: forall a. (Int :~: Bool) -> a
[GblId, Arity=1, Caf=NoCafRefs, Str=<L,U>x]
absurd = \ (@ a) (x :: Int :~: Bool) -> case x of { }
--- RHS size: {terms: 2, types: 0, coercions: 0}
-$trModule1 :: GHC.Types.TrName
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+$trModule1 :: GHC.Prim.Addr#
[GblId, Caf=NoCafRefs]
-$trModule1 = GHC.Types.TrNameS "main"#
+$trModule1 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
$trModule2 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs]
-$trModule2 = GHC.Types.TrNameS "T2431"#
+$trModule2 = GHC.Types.TrNameS $trModule1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+$trModule3 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs]
+$trModule3 = "T2431"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0}
+$trModule4 :: GHC.Types.TrName
+[GblId, Caf=NoCafRefs]
+$trModule4 = GHC.Types.TrNameS $trModule3
-- RHS size: {terms: 3, types: 0, coercions: 0}
T2431.$trModule :: GHC.Types.Module
[GblId, Caf=NoCafRefs]
-T2431.$trModule = GHC.Types.Module $trModule1 $trModule2
+T2431.$trModule = GHC.Types.Module $trModule2 $trModule4
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+$tc'Refl1 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs]
+$tc'Refl1 = "'Refl"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-$tc'Refl1 :: GHC.Types.TrName
+$tc'Refl2 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs]
-$tc'Refl1 = GHC.Types.TrNameS "'Refl"#
+$tc'Refl2 = GHC.Types.TrNameS $tc'Refl1
-- RHS size: {terms: 5, types: 0, coercions: 0}
T2431.$tc'Refl :: GHC.Types.TyCon
@@ -49,12 +64,17 @@ T2431.$tc'Refl =
15026191172322750497##
3898273167927206410##
T2431.$trModule
- $tc'Refl1
+ $tc'Refl2
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+$tc:~:1 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs]
+$tc:~:1 = ":~:"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-$tc:~:1 :: GHC.Types.TrName
+$tc:~:2 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs]
-$tc:~:1 = GHC.Types.TrNameS ":~:"#
+$tc:~:2 = GHC.Types.TrNameS $tc:~:1
-- RHS size: {terms: 5, types: 0, coercions: 0}
T2431.$tc:~: :: GHC.Types.TyCon
@@ -64,7 +84,7 @@ T2431.$tc:~: =
9759653149176674453##
12942818337407067047##
T2431.$trModule
- $tc:~:1
+ $tc:~:2
diff --git a/testsuite/tests/numeric/should_compile/T7116.stdout b/testsuite/tests/numeric/should_compile/T7116.stdout
index 9f7837bdc7..7fe4d93d87 100644
--- a/testsuite/tests/numeric/should_compile/T7116.stdout
+++ b/testsuite/tests/numeric/should_compile/T7116.stdout
@@ -1,15 +1,31 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 46, types: 23, coercions: 0}
+Result size of Tidy Core = {terms: 50, types: 25, coercions: 0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T7116.$trModule4 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+T7116.$trModule4 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-T7116.$trModule2 :: GHC.Types.TrName
+T7116.$trModule3 :: GHC.Types.TrName
[GblId,
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 20}]
-T7116.$trModule2 = GHC.Types.TrNameS "main"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T7116.$trModule3 = GHC.Types.TrNameS T7116.$trModule4
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T7116.$trModule2 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+T7116.$trModule2 = "T7116"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
T7116.$trModule1 :: GHC.Types.TrName
@@ -17,8 +33,8 @@ T7116.$trModule1 :: GHC.Types.TrName
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 40 20}]
-T7116.$trModule1 = GHC.Types.TrNameS "T7116"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T7116.$trModule1 = GHC.Types.TrNameS T7116.$trModule2
-- RHS size: {terms: 3, types: 0, coercions: 0}
T7116.$trModule :: GHC.Types.Module
@@ -28,7 +44,7 @@ T7116.$trModule :: GHC.Types.Module
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
T7116.$trModule =
- GHC.Types.Module T7116.$trModule2 T7116.$trModule1
+ GHC.Types.Module T7116.$trModule3 T7116.$trModule1
-- RHS size: {terms: 8, types: 3, coercions: 0}
dr :: Double -> Double
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 499650bd69..797cbd9d94 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -39,7 +39,7 @@ test('T1969',
# 2013-11-13 17 (x86/Windows, 64bit machine)
# 2015-07-11 21 (x86/Linux, 64bit machine) use +RTS -G1
# 2016-04-06 30 (x86/Linux, 64bit machine)
- (wordsize(64), 55, 20)]),
+ (wordsize(64), 68, 20)]),
# 28 (amd64/Linux)
# 34 (amd64/Linux)
# 2012-09-20 23 (amd64/Linux)
@@ -51,6 +51,8 @@ test('T1969',
# 2013-09-11 30, 15 (adapt to Phab CI)
# 2015-06-03 41, (amd64/Linux) use +RTS -G1
# 2015-10-28 55, (amd64/Linux) emit Typeable at definition site
+ # 2016-10-20 68, (amd64/Linux) allow top-level string literals
+ # See the comment 16 on #8472.
compiler_stats_num_field('max_bytes_used',
[(platform('i386-unknown-mingw32'), 5719436, 20),
# 2010-05-17 5717704 (x86/Windows)
@@ -827,7 +829,7 @@ test('T9233',
test('T10370',
[ only_ways(['optasm']),
compiler_stats_num_field('max_bytes_used', # Note [residency]
- [(wordsize(64), 33049168, 15),
+ [(wordsize(64), 38221184, 15),
# 2015-10-22 19548720
# 2016-02-24 22823976 Changing Levity to RuntimeRep; not sure why this regresses though, even after some analysis
# 2016-04-14 28256896 final demand analyzer run
@@ -838,14 +840,17 @@ test('T10370',
# affected stats on bootstrapped GHC. However,
# when I set -i0.01 with profiling, the heap profiles
# were identical, so I think it's just GC noise.
+ # 2016-10-20 38221184 Allow top-level string literals.
+ # See the comment 16 on #8472.
(wordsize(32), 11371496, 15),
# 2015-10-22 11371496
]),
compiler_stats_num_field('peak_megabytes_allocated', # Note [residency]
- [(wordsize(64), 121, 15),
+ [(wordsize(64), 146, 15),
# 2015-10-22 76
# 2016-04-14 101 final demand analyzer run
# 2016-08-08 121 see above
+ # 2017-01-18 146 Allow top-level string literals in Core
(wordsize(32), 39, 15),
# 2015-10-22 39
]),
@@ -883,8 +888,9 @@ test('T12227',
test('T12425',
[ only_ways(['optasm']),
compiler_stats_num_field('bytes allocated',
- [(wordsize(64), 125831400, 5),
+ [(wordsize(64), 133380960, 5),
# initial: 125831400
+ # 2017-01-18: 133380960 Allow top-level string literals in Core
]),
],
compile,
@@ -906,8 +912,9 @@ test('T12234',
test('T13035',
[ only_ways(['normal']),
compiler_stats_num_field('bytes allocated',
- [(wordsize(64), 90595208, 5),
+ [(wordsize(64), 95269000, 5),
# 2017-01-05 90595208 initial
+ # 2017-01-19 95269000 Allow top-level string literals in Core
]),
],
compile,
diff --git a/testsuite/tests/perf/should_run/T8472.hs b/testsuite/tests/perf/should_run/T8472.hs
new file mode 100644
index 0000000000..24f0ec7811
--- /dev/null
+++ b/testsuite/tests/perf/should_run/T8472.hs
@@ -0,0 +1,19 @@
+{-# LANGUAGE MagicHash #-}
+
+module Main (f, main) where
+
+import GHC.Exts(Ptr(..))
+import Foreign.Ptr
+
+-- We should be able to inline this function.
+f :: Ptr Int -> Int -> Int
+f =
+ let x = "foo"#
+ in \p n -> n + (Ptr x `minusPtr` p)
+
+main :: IO ()
+main = print $ x `mod` 2 == (x + 4) `mod` 2
+ where
+ x = go (10000::Int) 4
+ go 0 a = a
+ go n a = go (n-1) (f nullPtr a)
diff --git a/testsuite/tests/perf/should_run/T8472.stdout b/testsuite/tests/perf/should_run/T8472.stdout
new file mode 100644
index 0000000000..0ca95142bb
--- /dev/null
+++ b/testsuite/tests/perf/should_run/T8472.stdout
@@ -0,0 +1 @@
+True
diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T
index 333970ca57..1560e7ea2e 100644
--- a/testsuite/tests/perf/should_run/all.T
+++ b/testsuite/tests/perf/should_run/all.T
@@ -446,6 +446,14 @@ test('T9339',
compile_and_run,
['-O2'])
+test('T8472',
+ [stats_num_field('bytes allocated',
+ [ (wordsize(32), 50000, 80)
+ , (wordsize(64), 51424, 80) ]),
+ only_ways(['normal'])],
+ compile_and_run,
+ ['-O2'])
+
test('T12996',
[stats_num_field('bytes allocated',
[ (wordsize(64), 76776, 5) ]),
diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T
index 9acd157543..56a58cb586 100644
--- a/testsuite/tests/perf/space_leaks/all.T
+++ b/testsuite/tests/perf/space_leaks/all.T
@@ -64,7 +64,7 @@ test('T4029',
# 2016-07-13: 92 (amd64/Linux) Changes to tidyType
# 2016-09-01: 71 (amd64/Linux) Restore w/w limit (#11565)
stats_num_field('max_bytes_used',
- [(wordsize(64), 21387048 , 5)]),
+ [(wordsize(64), 21670448 , 5)]),
# 2016-02-26: 24071720 (amd64/Linux) INITIAL
# 2016-04-21: 25542832 (amd64/Linux)
# 2016-05-23: 25247216 (amd64/Linux) Use -G1
@@ -73,6 +73,7 @@ test('T4029',
# 2016-09-01: 21648488 (amd64/Linux) Restore w/w limit (#11565)
# 2016-10-13: 20325248 (amd64/Linux) Creep (downwards, yay!)
# 2016-11-14: 21387048 (amd64/Linux) Creep back upwards :(
+ # 2017-01-18: 21670448 (amd64/Linux) Float string literals to toplevel
extra_hc_opts('+RTS -G1 -RTS' ),
],
ghci_script,
diff --git a/testsuite/tests/roles/should_compile/Roles13.stderr b/testsuite/tests/roles/should_compile/Roles13.stderr
index f74c3abbb9..20206e28df 100644
--- a/testsuite/tests/roles/should_compile/Roles13.stderr
+++ b/testsuite/tests/roles/should_compile/Roles13.stderr
@@ -1,6 +1,6 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 51, types: 20, coercions: 5}
+Result size of Tidy Core = {terms: 63, types: 26, coercions: 5}
-- RHS size: {terms: 2, types: 2, coercions: 0}
convert1 :: Wrap Age -> Wrap Age
@@ -15,25 +15,40 @@ convert =
`cast` (<Wrap Age>_R -> Roles13.N:Wrap[0] Roles13.N:Age[0]
:: ((Wrap Age -> Wrap Age) :: *) ~R# ((Wrap Age -> Int) :: *))
--- RHS size: {terms: 2, types: 0, coercions: 0}
-$trModule1 :: GHC.Types.TrName
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+$trModule1 :: GHC.Prim.Addr#
[GblId, Caf=NoCafRefs]
-$trModule1 = GHC.Types.TrNameS "main"#
+$trModule1 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
$trModule2 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs]
-$trModule2 = GHC.Types.TrNameS "Roles13"#
+$trModule2 = GHC.Types.TrNameS $trModule1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+$trModule3 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs]
+$trModule3 = "Roles13"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0}
+$trModule4 :: GHC.Types.TrName
+[GblId, Caf=NoCafRefs]
+$trModule4 = GHC.Types.TrNameS $trModule3
-- RHS size: {terms: 3, types: 0, coercions: 0}
Roles13.$trModule :: GHC.Types.Module
[GblId, Caf=NoCafRefs]
-Roles13.$trModule = GHC.Types.Module $trModule1 $trModule2
+Roles13.$trModule = GHC.Types.Module $trModule2 $trModule4
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+$tc'MkAge1 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs]
+$tc'MkAge1 = "'MkAge"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-$tc'MkAge1 :: GHC.Types.TrName
+$tc'MkAge2 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs]
-$tc'MkAge1 = GHC.Types.TrNameS "'MkAge"#
+$tc'MkAge2 = GHC.Types.TrNameS $tc'MkAge1
-- RHS size: {terms: 5, types: 0, coercions: 0}
Roles13.$tc'MkAge :: GHC.Types.TyCon
@@ -43,12 +58,17 @@ Roles13.$tc'MkAge =
1226019810264079099##
12180888342844277416##
Roles13.$trModule
- $tc'MkAge1
+ $tc'MkAge2
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+$tcAge1 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs]
+$tcAge1 = "Age"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-$tcAge1 :: GHC.Types.TrName
+$tcAge2 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs]
-$tcAge1 = GHC.Types.TrNameS "Age"#
+$tcAge2 = GHC.Types.TrNameS $tcAge1
-- RHS size: {terms: 5, types: 0, coercions: 0}
Roles13.$tcAge :: GHC.Types.TyCon
@@ -58,12 +78,17 @@ Roles13.$tcAge =
18304088376370610314##
1954648846714895105##
Roles13.$trModule
- $tcAge1
+ $tcAge2
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+$tc'MkWrap1 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs]
+$tc'MkWrap1 = "'MkWrap"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-$tc'MkWrap1 :: GHC.Types.TrName
+$tc'MkWrap2 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs]
-$tc'MkWrap1 = GHC.Types.TrNameS "'MkWrap"#
+$tc'MkWrap2 = GHC.Types.TrNameS $tc'MkWrap1
-- RHS size: {terms: 5, types: 0, coercions: 0}
Roles13.$tc'MkWrap :: GHC.Types.TyCon
@@ -73,12 +98,17 @@ Roles13.$tc'MkWrap =
12402878715225676312##
13345418993613492500##
Roles13.$trModule
- $tc'MkWrap1
+ $tc'MkWrap2
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+$tcWrap1 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs]
+$tcWrap1 = "Wrap"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-$tcWrap1 :: GHC.Types.TrName
+$tcWrap2 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs]
-$tcWrap1 = GHC.Types.TrNameS "Wrap"#
+$tcWrap2 = GHC.Types.TrNameS $tcWrap1
-- RHS size: {terms: 5, types: 0, coercions: 0}
Roles13.$tcWrap :: GHC.Types.TyCon
@@ -88,7 +118,7 @@ Roles13.$tcWrap =
5278920226786541118##
14554440859491798587##
Roles13.$trModule
- $tcWrap1
+ $tcWrap2
diff --git a/testsuite/tests/simplCore/should_compile/Makefile b/testsuite/tests/simplCore/should_compile/Makefile
index 224e84c825..5a465d9818 100644
--- a/testsuite/tests/simplCore/should_compile/Makefile
+++ b/testsuite/tests/simplCore/should_compile/Makefile
@@ -185,3 +185,8 @@ T13025:
'$(TEST_HC)' $(TEST_HC_OPTS) -c -O T13025a.hs
-'$(TEST_HC)' $(TEST_HC_OPTS) -c -O T13025.hs -ddump-simpl | grep -c HEq_sc
# No lines should match 'HEq_sc' so wc should output zeros
+
+.PHONY: str-rules
+str-rules:
+ $(RM) -f str-rules.hi str-rules.o
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c -O str-rules.hs -ddump-simpl | grep -o '"@@@[^"].*"#' | sort
diff --git a/testsuite/tests/simplCore/should_compile/T3234.stderr b/testsuite/tests/simplCore/should_compile/T3234.stderr
index da96b43d9d..9d87b3ecc1 100644
--- a/testsuite/tests/simplCore/should_compile/T3234.stderr
+++ b/testsuite/tests/simplCore/should_compile/T3234.stderr
@@ -1,6 +1,6 @@
==================== FloatOut stats: ====================
-1 Lets floated to top level; 0 Lets floated elsewhere; from 1 Lambda groups
+2 Lets floated to top level; 0 Lets floated elsewhere; from 1 Lambda groups
@@ -10,9 +10,9 @@
==================== Grand total simplifier statistics ====================
-Total ticks: 51
+Total ticks: 54
-14 PreInlineUnconditionally
+15 PreInlineUnconditionally
1 n
1 g
1 a
@@ -27,6 +27,7 @@ Total ticks: 51
1 a
1 lvl
1 lvl
+ 1 lvl
4 PostInlineUnconditionally
1 c
1 n
@@ -39,7 +40,7 @@ Total ticks: 51
1 fold/build
1 unpack
1 unpack-list
-2 LetFloatFromLet 2
+4 LetFloatFromLet 4
25 BetaReduction
1 a
1 c
diff --git a/testsuite/tests/simplCore/should_compile/T3717.stderr b/testsuite/tests/simplCore/should_compile/T3717.stderr
index a7c1e55c52..f9adeb28da 100644
--- a/testsuite/tests/simplCore/should_compile/T3717.stderr
+++ b/testsuite/tests/simplCore/should_compile/T3717.stderr
@@ -1,15 +1,31 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 32, types: 13, coercions: 0}
+Result size of Tidy Core = {terms: 36, types: 15, coercions: 0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T3717.$trModule4 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+T3717.$trModule4 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-T3717.$trModule2 :: GHC.Types.TrName
+T3717.$trModule3 :: GHC.Types.TrName
[GblId,
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 20}]
-T3717.$trModule2 = GHC.Types.TrNameS "main"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T3717.$trModule3 = GHC.Types.TrNameS T3717.$trModule4
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T3717.$trModule2 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+T3717.$trModule2 = "T3717"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
T3717.$trModule1 :: GHC.Types.TrName
@@ -17,8 +33,8 @@ T3717.$trModule1 :: GHC.Types.TrName
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 40 20}]
-T3717.$trModule1 = GHC.Types.TrNameS "T3717"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T3717.$trModule1 = GHC.Types.TrNameS T3717.$trModule2
-- RHS size: {terms: 3, types: 0, coercions: 0}
T3717.$trModule :: GHC.Types.Module
@@ -28,7 +44,7 @@ T3717.$trModule :: GHC.Types.Module
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
T3717.$trModule =
- GHC.Types.Module T3717.$trModule2 T3717.$trModule1
+ GHC.Types.Module T3717.$trModule3 T3717.$trModule1
Rec {
-- RHS size: {terms: 10, types: 2, coercions: 0}
diff --git a/testsuite/tests/simplCore/should_compile/T3772.stdout b/testsuite/tests/simplCore/should_compile/T3772.stdout
index d70c0eee55..76936e336f 100644
--- a/testsuite/tests/simplCore/should_compile/T3772.stdout
+++ b/testsuite/tests/simplCore/should_compile/T3772.stdout
@@ -1,6 +1,6 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 36, types: 14, coercions: 0}
+Result size of Tidy Core = {terms: 40, types: 16, coercions: 0}
Rec {
-- RHS size: {terms: 10, types: 2, coercions: 0}
@@ -26,23 +26,39 @@ foo =
}
}
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T3772.$trModule2 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+T3772.$trModule2 = "T3772"#
+
-- RHS size: {terms: 2, types: 0, coercions: 0}
T3772.$trModule1 :: GHC.Types.TrName
[GblId,
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 40 20}]
-T3772.$trModule1 = GHC.Types.TrNameS "T3772"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T3772.$trModule1 = GHC.Types.TrNameS T3772.$trModule2
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T3772.$trModule4 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+T3772.$trModule4 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-T3772.$trModule2 :: GHC.Types.TrName
+T3772.$trModule3 :: GHC.Types.TrName
[GblId,
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 20}]
-T3772.$trModule2 = GHC.Types.TrNameS "main"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T3772.$trModule3 = GHC.Types.TrNameS T3772.$trModule4
-- RHS size: {terms: 3, types: 0, coercions: 0}
T3772.$trModule :: GHC.Types.Module
@@ -52,7 +68,7 @@ T3772.$trModule :: GHC.Types.Module
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
T3772.$trModule =
- GHC.Types.Module T3772.$trModule2 T3772.$trModule1
+ GHC.Types.Module T3772.$trModule3 T3772.$trModule1
diff --git a/testsuite/tests/simplCore/should_compile/T4908.stderr b/testsuite/tests/simplCore/should_compile/T4908.stderr
index 7136bd1f51..e9957bf9de 100644
--- a/testsuite/tests/simplCore/should_compile/T4908.stderr
+++ b/testsuite/tests/simplCore/should_compile/T4908.stderr
@@ -1,15 +1,31 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 64, types: 41, coercions: 0}
+Result size of Tidy Core = {terms: 68, types: 43, coercions: 0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T4908.$trModule4 :: Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+T4908.$trModule4 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-T4908.$trModule2 :: TrName
+T4908.$trModule3 :: TrName
[GblId,
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 20}]
-T4908.$trModule2 = GHC.Types.TrNameS "main"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T4908.$trModule3 = GHC.Types.TrNameS T4908.$trModule4
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T4908.$trModule2 :: Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+T4908.$trModule2 = "T4908"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
T4908.$trModule1 :: TrName
@@ -17,8 +33,8 @@ T4908.$trModule1 :: TrName
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 40 20}]
-T4908.$trModule1 = GHC.Types.TrNameS "T4908"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T4908.$trModule1 = GHC.Types.TrNameS T4908.$trModule2
-- RHS size: {terms: 3, types: 0, coercions: 0}
T4908.$trModule :: Module
@@ -28,7 +44,7 @@ T4908.$trModule :: Module
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
T4908.$trModule =
- GHC.Types.Module T4908.$trModule2 T4908.$trModule1
+ GHC.Types.Module T4908.$trModule3 T4908.$trModule1
Rec {
-- RHS size: {terms: 19, types: 5, coercions: 0}
diff --git a/testsuite/tests/simplCore/should_compile/T4930.stderr b/testsuite/tests/simplCore/should_compile/T4930.stderr
index 7e51aa68be..365584d3d0 100644
--- a/testsuite/tests/simplCore/should_compile/T4930.stderr
+++ b/testsuite/tests/simplCore/should_compile/T4930.stderr
@@ -1,15 +1,31 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 45, types: 17, coercions: 0}
+Result size of Tidy Core = {terms: 49, types: 19, coercions: 0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T4930.$trModule4 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+T4930.$trModule4 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-T4930.$trModule2 :: GHC.Types.TrName
+T4930.$trModule3 :: GHC.Types.TrName
[GblId,
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 20}]
-T4930.$trModule2 = GHC.Types.TrNameS "main"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T4930.$trModule3 = GHC.Types.TrNameS T4930.$trModule4
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T4930.$trModule2 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+T4930.$trModule2 = "T4930"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
T4930.$trModule1 :: GHC.Types.TrName
@@ -17,8 +33,8 @@ T4930.$trModule1 :: GHC.Types.TrName
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 40 20}]
-T4930.$trModule1 = GHC.Types.TrNameS "T4930"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T4930.$trModule1 = GHC.Types.TrNameS T4930.$trModule2
-- RHS size: {terms: 3, types: 0, coercions: 0}
T4930.$trModule :: GHC.Types.Module
@@ -28,7 +44,7 @@ T4930.$trModule :: GHC.Types.Module
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
T4930.$trModule =
- GHC.Types.Module T4930.$trModule2 T4930.$trModule1
+ GHC.Types.Module T4930.$trModule3 T4930.$trModule1
Rec {
-- RHS size: {terms: 23, types: 6, coercions: 0}
diff --git a/testsuite/tests/simplCore/should_compile/T7360.stderr b/testsuite/tests/simplCore/should_compile/T7360.stderr
index 2b0984c8d5..2e387b27bc 100644
--- a/testsuite/tests/simplCore/should_compile/T7360.stderr
+++ b/testsuite/tests/simplCore/should_compile/T7360.stderr
@@ -1,6 +1,6 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 82, types: 42, coercions: 0}
+Result size of Tidy Core = {terms: 94, types: 48, coercions: 0}
-- RHS size: {terms: 6, types: 3, coercions: 0}
T7360.$WFoo3 [InlPrag=INLINE] :: Int -> Foo
@@ -66,14 +66,30 @@ fun2 =
}
})
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T7360.$trModule4 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+T7360.$trModule4 = "main"#
+
-- RHS size: {terms: 2, types: 0, coercions: 0}
-T7360.$trModule2 :: GHC.Types.TrName
+T7360.$trModule3 :: GHC.Types.TrName
[GblId,
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 20}]
-T7360.$trModule2 = GHC.Types.TrNameS "main"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T7360.$trModule3 = GHC.Types.TrNameS T7360.$trModule4
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T7360.$trModule2 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+T7360.$trModule2 = "T7360"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
T7360.$trModule1 :: GHC.Types.TrName
@@ -81,8 +97,8 @@ T7360.$trModule1 :: GHC.Types.TrName
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 40 20}]
-T7360.$trModule1 = GHC.Types.TrNameS "T7360"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T7360.$trModule1 = GHC.Types.TrNameS T7360.$trModule2
-- RHS size: {terms: 3, types: 0, coercions: 0}
T7360.$trModule :: GHC.Types.Module
@@ -92,16 +108,24 @@ T7360.$trModule :: GHC.Types.Module
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
T7360.$trModule =
- GHC.Types.Module T7360.$trModule2 T7360.$trModule1
+ GHC.Types.Module T7360.$trModule3 T7360.$trModule1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T7360.$tc'Foo9 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+T7360.$tc'Foo9 = "'Foo3"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-T7360.$tc'Foo6 :: GHC.Types.TrName
+T7360.$tc'Foo8 :: GHC.Types.TrName
[GblId,
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 40 20}]
-T7360.$tc'Foo6 = GHC.Types.TrNameS "'Foo3"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T7360.$tc'Foo8 = GHC.Types.TrNameS T7360.$tc'Foo9
-- RHS size: {terms: 5, types: 0, coercions: 0}
T7360.$tc'Foo3 :: GHC.Types.TyCon
@@ -115,16 +139,24 @@ T7360.$tc'Foo3 =
10507205234936349519##
8302184214013227554##
T7360.$trModule
- T7360.$tc'Foo6
+ T7360.$tc'Foo8
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T7360.$tc'Foo7 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+T7360.$tc'Foo7 = "'Foo2"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-T7360.$tc'Foo5 :: GHC.Types.TrName
+T7360.$tc'Foo6 :: GHC.Types.TrName
[GblId,
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 40 20}]
-T7360.$tc'Foo5 = GHC.Types.TrNameS "'Foo2"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T7360.$tc'Foo6 = GHC.Types.TrNameS T7360.$tc'Foo7
-- RHS size: {terms: 5, types: 0, coercions: 0}
T7360.$tc'Foo2 :: GHC.Types.TyCon
@@ -138,7 +170,15 @@ T7360.$tc'Foo2 =
9825259700232563546##
11056638024476048052##
T7360.$trModule
- T7360.$tc'Foo5
+ T7360.$tc'Foo6
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T7360.$tc'Foo5 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+T7360.$tc'Foo5 = "'Foo1"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
T7360.$tc'Foo4 :: GHC.Types.TrName
@@ -146,8 +186,8 @@ T7360.$tc'Foo4 :: GHC.Types.TrName
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 40 20}]
-T7360.$tc'Foo4 = GHC.Types.TrNameS "'Foo1"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T7360.$tc'Foo4 = GHC.Types.TrNameS T7360.$tc'Foo5
-- RHS size: {terms: 5, types: 0, coercions: 0}
T7360.$tc'Foo1 :: GHC.Types.TyCon
@@ -163,14 +203,22 @@ T7360.$tc'Foo1 =
T7360.$trModule
T7360.$tc'Foo4
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+T7360.$tcFoo2 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+T7360.$tcFoo2 = "Foo"#
+
-- RHS size: {terms: 2, types: 0, coercions: 0}
T7360.$tcFoo1 :: GHC.Types.TrName
[GblId,
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 20}]
-T7360.$tcFoo1 = GHC.Types.TrNameS "Foo"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+T7360.$tcFoo1 = GHC.Types.TrNameS T7360.$tcFoo2
-- RHS size: {terms: 5, types: 0, coercions: 0}
T7360.$tcFoo :: GHC.Types.TyCon
diff --git a/testsuite/tests/simplCore/should_compile/T8274.stdout b/testsuite/tests/simplCore/should_compile/T8274.stdout
index 43830c7135..df8253f510 100644
--- a/testsuite/tests/simplCore/should_compile/T8274.stdout
+++ b/testsuite/tests/simplCore/should_compile/T8274.stdout
@@ -1,12 +1,18 @@
p = T8274.Positives 42# 4.23# 4.23## '4'# 4##
n = T8274.Negatives -4# -4.0# -4.0##
-T8274.$trModule2 = GHC.Types.TrNameS "main"#
-T8274.$trModule1 = GHC.Types.TrNameS "T8274"#
-T8274.$tc'Positives1 = GHC.Types.TrNameS "'Positives"#
+T8274.$trModule4 :: Addr#
+T8274.$trModule4 = "main"#
+T8274.$trModule2 :: Addr#
+T8274.$trModule2 = "T8274"#
+T8274.$tc'Positives2 :: Addr#
+T8274.$tc'Positives2 = "'Positives"#
T8274.$tc'Positives = GHC.Types.TyCon 14732531009298850569## 4925356269917933860## T8274.$trModule T8274.$tc'Positives1
-T8274.$tcP1 = GHC.Types.TrNameS "P"#
+T8274.$tcP2 :: Addr#
+T8274.$tcP2 = "P"#
T8274.$tcP = GHC.Types.TyCon 11095028091707994303## 9476557054198009608## T8274.$trModule T8274.$tcP1
-T8274.$tc'Negatives1 = GHC.Types.TrNameS "'Negatives"#
+T8274.$tc'Negatives2 :: Addr#
+T8274.$tc'Negatives2 = "'Negatives"#
T8274.$tc'Negatives = GHC.Types.TyCon 15950179315687996644## 11481167534507418130## T8274.$trModule T8274.$tc'Negatives1
-T8274.$tcN1 = GHC.Types.TrNameS "N"#
+T8274.$tcN2 :: Addr#
+T8274.$tcN2 = "N"#
T8274.$tcN = GHC.Types.TyCon 7479687563082171902## 17616649989360543185## T8274.$trModule T8274.$tcN1
diff --git a/testsuite/tests/simplCore/should_compile/T9400.stderr b/testsuite/tests/simplCore/should_compile/T9400.stderr
index bab1751a86..92979b36b1 100644
--- a/testsuite/tests/simplCore/should_compile/T9400.stderr
+++ b/testsuite/tests/simplCore/should_compile/T9400.stderr
@@ -1,21 +1,31 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 33, types: 20, coercions: 0}
+Result size of Tidy Core = {terms: 37, types: 22, coercions: 0}
--- RHS size: {terms: 2, types: 0, coercions: 0}
-$trModule1 :: TrName
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+$trModule1 :: Addr#
[GblId, Caf=NoCafRefs]
-$trModule1 = GHC.Types.TrNameS "main"#
+$trModule1 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
$trModule2 :: TrName
[GblId, Caf=NoCafRefs]
-$trModule2 = GHC.Types.TrNameS "T9400"#
+$trModule2 = GHC.Types.TrNameS $trModule1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+$trModule3 :: Addr#
+[GblId, Caf=NoCafRefs]
+$trModule3 = "T9400"#
+
+-- RHS size: {terms: 2, types: 0, coercions: 0}
+$trModule4 :: TrName
+[GblId, Caf=NoCafRefs]
+$trModule4 = GHC.Types.TrNameS $trModule3
-- RHS size: {terms: 3, types: 0, coercions: 0}
T9400.$trModule :: Module
[GblId, Caf=NoCafRefs]
-T9400.$trModule = GHC.Types.Module $trModule1 $trModule2
+T9400.$trModule = GHC.Types.Module $trModule2 $trModule4
-- RHS size: {terms: 22, types: 15, coercions: 0}
main :: IO ()
diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T
index 19e9f1d3a4..2ede2468ee 100644
--- a/testsuite/tests/simplCore/should_compile/all.T
+++ b/testsuite/tests/simplCore/should_compile/all.T
@@ -263,3 +263,7 @@ test('T13025',
['$MAKE -s --no-print-directory T13025'])
test('T13156', normal, run_command, ['$MAKE -s --no-print-directory T13156'])
test('T11444', normal, compile, [''])
+test('str-rules',
+ normal,
+ run_command,
+ ['$MAKE -s --no-print-directory str-rules'])
diff --git a/testsuite/tests/simplCore/should_compile/noinline01.stderr b/testsuite/tests/simplCore/should_compile/noinline01.stderr
index b100172381..1bb98e57b4 100644
--- a/testsuite/tests/simplCore/should_compile/noinline01.stderr
+++ b/testsuite/tests/simplCore/should_compile/noinline01.stderr
@@ -9,17 +9,25 @@ Noinline01.g :: GHC.Types.Bool
[GblId] =
\u [] Noinline01.f GHC.Types.False;
-Noinline01.$trModule2 :: GHC.Types.TrName
+Noinline01.$trModule4 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs, Unf=OtherCon []] =
+ "main"#;
+
+Noinline01.$trModule3 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs, Str=m1, Unf=OtherCon []] =
- NO_CCS GHC.Types.TrNameS! ["main"#];
+ NO_CCS GHC.Types.TrNameS! [Noinline01.$trModule4];
+
+Noinline01.$trModule2 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs, Unf=OtherCon []] =
+ "Noinline01"#;
Noinline01.$trModule1 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs, Str=m1, Unf=OtherCon []] =
- NO_CCS GHC.Types.TrNameS! ["Noinline01"#];
+ NO_CCS GHC.Types.TrNameS! [Noinline01.$trModule2];
Noinline01.$trModule :: GHC.Types.Module
[GblId, Caf=NoCafRefs, Str=m, Unf=OtherCon []] =
- NO_CCS GHC.Types.Module! [Noinline01.$trModule2
+ NO_CCS GHC.Types.Module! [Noinline01.$trModule3
Noinline01.$trModule1];
@@ -34,17 +42,25 @@ Noinline01.g :: GHC.Types.Bool
[GblId] =
\u [] Noinline01.f GHC.Types.False;
-Noinline01.$trModule2 :: GHC.Types.TrName
+Noinline01.$trModule4 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs, Unf=OtherCon []] =
+ "main"#;
+
+Noinline01.$trModule3 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs, Str=m1, Unf=OtherCon []] =
- NO_CCS GHC.Types.TrNameS! ["main"#];
+ NO_CCS GHC.Types.TrNameS! [Noinline01.$trModule4];
+
+Noinline01.$trModule2 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs, Unf=OtherCon []] =
+ "Noinline01"#;
Noinline01.$trModule1 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs, Str=m1, Unf=OtherCon []] =
- NO_CCS GHC.Types.TrNameS! ["Noinline01"#];
+ NO_CCS GHC.Types.TrNameS! [Noinline01.$trModule2];
Noinline01.$trModule :: GHC.Types.Module
[GblId, Caf=NoCafRefs, Str=m, Unf=OtherCon []] =
- NO_CCS GHC.Types.Module! [Noinline01.$trModule2
+ NO_CCS GHC.Types.Module! [Noinline01.$trModule3
Noinline01.$trModule1];
diff --git a/testsuite/tests/simplCore/should_compile/par01.stderr b/testsuite/tests/simplCore/should_compile/par01.stderr
index 90d467f71c..4ccb9d892b 100644
--- a/testsuite/tests/simplCore/should_compile/par01.stderr
+++ b/testsuite/tests/simplCore/should_compile/par01.stderr
@@ -1,6 +1,6 @@
==================== CorePrep ====================
-Result size of CorePrep = {terms: 18, types: 8, coercions: 0}
+Result size of CorePrep = {terms: 22, types: 10, coercions: 0}
Rec {
-- RHS size: {terms: 7, types: 3, coercions: 0}
@@ -13,21 +13,31 @@ Par01.depth =
}
end Rec }
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+Par01.$trModule4 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs, Unf=OtherCon []]
+Par01.$trModule4 = "main"#
+
-- RHS size: {terms: 2, types: 0, coercions: 0}
-Par01.$trModule2 :: GHC.Types.TrName
+Par01.$trModule3 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs, Str=m1, Unf=OtherCon []]
-Par01.$trModule2 = GHC.Types.TrNameS "main"#
+Par01.$trModule3 = GHC.Types.TrNameS Par01.$trModule4
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+Par01.$trModule2 :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs, Unf=OtherCon []]
+Par01.$trModule2 = "Par01"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
Par01.$trModule1 :: GHC.Types.TrName
[GblId, Caf=NoCafRefs, Str=m1, Unf=OtherCon []]
-Par01.$trModule1 = GHC.Types.TrNameS "Par01"#
+Par01.$trModule1 = GHC.Types.TrNameS Par01.$trModule2
-- RHS size: {terms: 3, types: 0, coercions: 0}
Par01.$trModule :: GHC.Types.Module
[GblId, Caf=NoCafRefs, Str=m, Unf=OtherCon []]
Par01.$trModule =
- GHC.Types.Module Par01.$trModule2 Par01.$trModule1
+ GHC.Types.Module Par01.$trModule3 Par01.$trModule1
diff --git a/testsuite/tests/simplCore/should_compile/rule2.stderr b/testsuite/tests/simplCore/should_compile/rule2.stderr
index 844afc63d6..572fac36a8 100644
--- a/testsuite/tests/simplCore/should_compile/rule2.stderr
+++ b/testsuite/tests/simplCore/should_compile/rule2.stderr
@@ -10,14 +10,14 @@
==================== Grand total simplifier statistics ====================
-Total ticks: 13
+Total ticks: 15
2 PreInlineUnconditionally
1 f
1 lvl
1 UnfoldingDone 1 Roman.bar
1 RuleFired 1 foo/bar
-1 LetFloatFromLet 1
+3 LetFloatFromLet 3
1 EtaReduction 1 ds
7 BetaReduction
1 f
diff --git a/testsuite/tests/simplCore/should_compile/spec-inline.stderr b/testsuite/tests/simplCore/should_compile/spec-inline.stderr
index e7fc531a43..0de46d181d 100644
--- a/testsuite/tests/simplCore/should_compile/spec-inline.stderr
+++ b/testsuite/tests/simplCore/should_compile/spec-inline.stderr
@@ -1,15 +1,31 @@
==================== Tidy Core ====================
-Result size of Tidy Core = {terms: 172, types: 65, coercions: 0}
+Result size of Tidy Core = {terms: 178, types: 68, coercions: 0}
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+Roman.$trModule4 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
+Roman.$trModule4 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
-Roman.$trModule2 :: GHC.Types.TrName
+Roman.$trModule3 :: GHC.Types.TrName
[GblId,
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 20}]
-Roman.$trModule2 = GHC.Types.TrNameS "main"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+Roman.$trModule3 = GHC.Types.TrNameS Roman.$trModule4
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+Roman.$trModule2 :: GHC.Prim.Addr#
+[GblId,
+ Caf=NoCafRefs,
+ Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}]
+Roman.$trModule2 = "Roman"#
-- RHS size: {terms: 2, types: 0, coercions: 0}
Roman.$trModule1 :: GHC.Types.TrName
@@ -17,8 +33,8 @@ Roman.$trModule1 :: GHC.Types.TrName
Caf=NoCafRefs,
Str=m1,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
- WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 40 20}]
-Roman.$trModule1 = GHC.Types.TrNameS "Roman"#
+ WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}]
+Roman.$trModule1 = GHC.Types.TrNameS Roman.$trModule2
-- RHS size: {terms: 3, types: 0, coercions: 0}
Roman.$trModule :: GHC.Types.Module
@@ -28,16 +44,18 @@ Roman.$trModule :: GHC.Types.Module
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}]
Roman.$trModule =
- GHC.Types.Module Roman.$trModule2 Roman.$trModule1
+ GHC.Types.Module Roman.$trModule3 Roman.$trModule1
+
+-- RHS size: {terms: 1, types: 0, coercions: 0}
+lvl :: GHC.Prim.Addr#
+[GblId, Caf=NoCafRefs]
+lvl = "spec-inline.hs:(19,5)-(29,25)|function go"#
-- RHS size: {terms: 2, types: 2, coercions: 0}
Roman.foo3 :: Int
[GblId, Str=x]
Roman.foo3 =
- Control.Exception.Base.patError
- @ 'GHC.Types.LiftedRep
- @ Int
- "spec-inline.hs:(19,5)-(29,25)|function go"#
+ Control.Exception.Base.patError @ 'GHC.Types.LiftedRep @ Int lvl
Rec {
-- RHS size: {terms: 55, types: 9, coercions: 0}
diff --git a/testsuite/tests/simplCore/should_compile/str-rules.hs b/testsuite/tests/simplCore/should_compile/str-rules.hs
new file mode 100644
index 0000000000..a94df9958c
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/str-rules.hs
@@ -0,0 +1,20 @@
+{-# LANGUAGE MagicHash #-}
+import GHC.CString (unpackFoldrCString#, unpackCString#)
+import GHC.Base (eqString)
+main :: IO ()
+main = do
+ let mix c n = fromEnum c + n
+ n <- readLn
+
+ print $
+ -- We expect the two literals to be concatenated, resulting in "@@@ ab"
+ unpackFoldrCString# "@@@ a"# mix
+ (unpackFoldrCString# "b"# mix n)
+
+ if eqString (unpackCString# "x"#) (unpackCString# "y"#)
+ then putStrLn $ unpackCString# "@@@ c"# -- this should be optimized out
+ else putStrLn $ unpackCString# "@@@ d"#
+
+ if eqString (unpackCString# "foo"#) (unpackCString# "foo"#)
+ then putStrLn $ unpackCString# "@@@ e"#
+ else putStrLn $ unpackCString# "@@@ f"# -- this should be optimized out
diff --git a/testsuite/tests/simplCore/should_compile/str-rules.stdout b/testsuite/tests/simplCore/should_compile/str-rules.stdout
new file mode 100644
index 0000000000..a3f3ae899d
--- /dev/null
+++ b/testsuite/tests/simplCore/should_compile/str-rules.stdout
@@ -0,0 +1,3 @@
+"@@@ ab"#
+"@@@ d"#
+"@@@ e"#