summaryrefslogtreecommitdiff
path: root/testsuite/tests/perf
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2020-12-04 14:17:56 -0500
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-12-05 09:07:13 -0500
commit8fac4b9333ef3607e75b4520d847054316cb8c2d (patch)
treecea86e21d679a3b58c4110da8071f61d3fa4e83e /testsuite/tests/perf
parent4a437bc19d2026845948356a932b2cac2417eb12 (diff)
downloadhaskell-8fac4b9333ef3607e75b4520d847054316cb8c2d.tar.gz
testsuite: Add a test for #18923
Diffstat (limited to 'testsuite/tests/perf')
-rw-r--r--testsuite/tests/perf/compiler/T18923.hs16
-rw-r--r--testsuite/tests/perf/compiler/all.T4
2 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/perf/compiler/T18923.hs b/testsuite/tests/perf/compiler/T18923.hs
new file mode 100644
index 0000000000..4127469283
--- /dev/null
+++ b/testsuite/tests/perf/compiler/T18923.hs
@@ -0,0 +1,16 @@
+module T18923 (mergeRec, Rec) where
+
+mayMerge :: Maybe b -> Maybe b -> Maybe b
+mayMerge Nothing y = y
+mayMerge x Nothing = x
+mayMerge (Just x) (Just y) = Just y
+
+data Rec = Rec { v0,v1,v2,v3,v4,v5,v6,v7 :: !(Maybe Bool) }
+
+mergeRec :: Rec -> Rec -> Rec
+mergeRec
+ (Rec a0 a1 a2 a3 a4 a5 a6 a7)
+ (Rec b0 b1 b2 b3 b4 b5 b6 b7) =
+ Rec (mayMerge a0 b0) (mayMerge a1 b1) (mayMerge a2 b2) (mayMerge a3 b3)
+ (mayMerge a4 b4) (mayMerge a5 b5) (mayMerge a6 b6) (mayMerge a7 b7)
+
diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T
index 46222c723a..1eace3ac0a 100644
--- a/testsuite/tests/perf/compiler/all.T
+++ b/testsuite/tests/perf/compiler/all.T
@@ -434,3 +434,7 @@ test ('T18223',
],
compile,
['-v0 -O'])
+test ('T18923',
+ [ collect_compiler_stats('bytes allocated',2) ],
+ compile,
+ ['-v0 -O'])