summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2021-07-02 08:50:16 +0100
committerSimon Peyton Jones <simonpj@microsoft.com>2021-07-19 10:59:38 +0100
commit5b187575dac64e0a202f0700bdb7a1d1604f9438 (patch)
tree9f24e24b67c08dfab0e1cf44fda2edb195382889 /testsuite/tests
parent41d6cfc4d36ba93d82f16f9a83ea69f4e02c3810 (diff)
downloadhaskell-5b187575dac64e0a202f0700bdb7a1d1604f9438.tar.gz
Better sharing of join points (#19996)wip/T19557
This patch, provoked by regressions in the text package (#19557), improves sharing of join points. This also fixes the terrible behaviour in #20049. See Note [Duplicating join points] in GHC.Core.Opt.Simplify. * In the StrictArg case of mkDupableContWithDmds, don't use Plan A for data constructors * In postInlineUnconditionally, don't inline JoinIds Avoids inlining join $j x = Just x in case blah of A -> $j x1 B -> $j x2 C -> $j x3 * In mkDupableStrictBind and mkDupableStrictAlt, create join points (much) more often: exprIsTrivial rather than exprIsDupable. This may be much, but we'll see. Metric Decrease: T12545 T13253-spj T13719 T18140 T18282 T18304 T18698a T18698b Metric Increase: T16577 T18923 T9961
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/perf/compiler/T20049.hs53
-rw-r--r--testsuite/tests/perf/compiler/all.T4
2 files changed, 57 insertions, 0 deletions
diff --git a/testsuite/tests/perf/compiler/T20049.hs b/testsuite/tests/perf/compiler/T20049.hs
new file mode 100644
index 0000000000..2a6c1c56fc
--- /dev/null
+++ b/testsuite/tests/perf/compiler/T20049.hs
@@ -0,0 +1,53 @@
+{-# OPTIONS_GHC -O1 #-}
+module Repro where
+
+data A = A
+ { a1 :: (Maybe ())
+ , a2 :: (Maybe ())
+ , a3 :: (Maybe ())
+ , a4 :: (Maybe ())
+ , a5 :: (Maybe ())
+ , a6 :: (Maybe ())
+ , a7 :: (Maybe ())
+ , a8 :: (Maybe ())
+ , a9 :: (Maybe ())
+ , a10 :: (Maybe ())
+ , a11 :: (Maybe ())
+ , a12 :: (Maybe ())
+ }
+
+data B = B
+ { b1 :: !Bool
+ , b2 :: !Bool
+ , b3 :: !Bool
+ , b4 :: !Bool
+ , b5 :: !Bool
+ , b6 :: !Bool
+ , b7 :: !Bool
+ , b8 :: !Bool
+ , b9 :: !Bool
+ , b10 :: !Bool
+ , b11 :: !Bool
+ , b12 :: !Bool
+ }
+
+f :: Maybe () -> Bool
+f (Just ()) = True
+f Nothing = False
+
+g :: A -> B
+g (A a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12) =
+ B {
+ b1 = f a1
+ , b2 = f a2
+ , b3 = f a3
+ , b4 = f a4
+ , b5 = f a5
+ , b6 = f a6
+ , b7 = f a7
+ , b8 = f a8
+ , b9 = f a9
+ , b10 = f a10
+ , b11 = f a11
+ , b12 = f a12
+ }
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index ee764f15cb..6628fb377e 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -477,3 +477,7 @@ test('T11545',
test('T15304',
[ collect_compiler_stats('all', 10) ],
compile, ['-O'])
+test ('T20049',
+ [ collect_compiler_stats('bytes allocated',2) ],
+ compile,
+ [''])