summaryrefslogtreecommitdiff
path: root/testsuite/tests/stranal
diff options
context:
space:
mode:
authorAndreas Klebinger <klebinger.andreas@gmx.at>2022-05-04 10:50:04 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-06-27 08:01:39 -0400
commitac7a7fc88b51f9fb4e84499397e12eb0081ba79e (patch)
tree075714e3c20f6aa770e8a5cb508112436fe466b5 /testsuite/tests/stranal
parent38378be3506f0d4f597fcd5aa2d9db3124fbf535 (diff)
downloadhaskell-ac7a7fc88b51f9fb4e84499397e12eb0081ba79e.tar.gz
Don't mark lambda binders as OtherCon
We used to put OtherCon unfoldings on lambda binders of workers and sometimes also join points/specializations with with the assumption that since the wrapper would force these arguments once we execute the RHS they would indeed be in WHNF. This was wrong for reasons detailed in #21472. So now we purge evaluated unfoldings from *all* lambda binders. This fixes #21472, but at the cost of sometimes not using as efficient a calling convention. It can also change inlining behaviour as some occurances will no longer look like value arguments when they did before. As consequence we also change how we compute CBV information for arguments slightly. We now *always* determine the CBV convention for arguments during tidy. Earlier in the pipeline we merely mark functions as candidates for having their arguments treated as CBV. As before the process is described in the relevant notes: Note [CBV Function Ids] Note [Attaching CBV Marks to ids] Note [Never put `OtherCon` unfoldigns on lambda binders] ------------------------- Metric Decrease: T12425 T13035 T18223 T18223 T18923 MultiLayerModulesTH_OneShot Metric Increase: WWRec -------------------------
Diffstat (limited to 'testsuite/tests/stranal')
-rw-r--r--testsuite/tests/stranal/should_compile/T20817.stderr8
-rw-r--r--testsuite/tests/stranal/sigs/T16197b.hs5
-rw-r--r--testsuite/tests/stranal/sigs/T16197b.stderr20
-rw-r--r--testsuite/tests/stranal/sigs/T16859.stderr6
-rw-r--r--testsuite/tests/stranal/sigs/all.T2
5 files changed, 29 insertions, 12 deletions
diff --git a/testsuite/tests/stranal/should_compile/T20817.stderr b/testsuite/tests/stranal/should_compile/T20817.stderr
index ba364234db..c113c3c2d1 100644
--- a/testsuite/tests/stranal/should_compile/T20817.stderr
+++ b/testsuite/tests/stranal/should_compile/T20817.stderr
@@ -234,10 +234,10 @@ Rec {
-- RHS size: {terms: 34, types: 36, coercions: 0, joins: 0/0}
$wg [InlPrag=[2],
Occ=LoopBreaker,
- Dmd=LCL(C1(C1(C1(C1(C1(C1(!L)))))))]
+ Dmd=LCS(C1(C1(C1(C1(C1(C1(L)))))))]
:: forall {a} {b} {c} {d} {e} {t} {t} {t}.
Bool -> a -> b -> c -> t -> t -> t -> (# a, b, c, t, t, t #)
-[LclId[StrictWorker([!, ~, ~, ~, ~, ~, ~])],
+[LclId[StrictWorker([])],
Arity=7,
Str=<1L><L><L><L><L><L><L>,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
@@ -252,9 +252,7 @@ $wg
(@t)
(@t)
(@t)
- (ds [Dmd=1L]
- :: Bool
- Unf=OtherCon [])
+ (ds [Dmd=1L] :: Bool)
(ww :: a)
(ww :: b)
(ww :: c)
diff --git a/testsuite/tests/stranal/sigs/T16197b.hs b/testsuite/tests/stranal/sigs/T16197b.hs
index 4ce440d3bf..dda6670c64 100644
--- a/testsuite/tests/stranal/sigs/T16197b.hs
+++ b/testsuite/tests/stranal/sigs/T16197b.hs
@@ -2,6 +2,11 @@
-- Important takeaway: The signature of `f` may not say "strict in the Bool
-- field of T", otherwise the Simplifier will drop the `seq` on the `Bool` at
-- call sites after unboxing the `T`.
+--
+-- Now (with #21497) this has a twist. When we do w/w we insert seqs to make the worker strict in
+-- strict fields. This means the simplifier might drop the seq at the call site
+-- but we will seq inside the worker so things still work.
+-- So instead of checking the strictness sig we now check if there is a seq in the worker.
module T16197b where
data T = T !Bool
diff --git a/testsuite/tests/stranal/sigs/T16197b.stderr b/testsuite/tests/stranal/sigs/T16197b.stderr
index d4c250b44a..88988c266b 100644
--- a/testsuite/tests/stranal/sigs/T16197b.stderr
+++ b/testsuite/tests/stranal/sigs/T16197b.stderr
@@ -1,15 +1,29 @@
==================== Strictness signatures ====================
-T16197b.f: <1!P(L)>
+f: <1!P(L)>
==================== Cpr signatures ====================
-T16197b.f: 1
+f: 1
==================== Strictness signatures ====================
-T16197b.f: <1!P(L)>
+f: <1!P(1L)>
+
+
+
+==================== Tidy Core ====================
+Result size of Tidy Core
+ = {terms: 25, types: 23, coercions: 0, joins: 0/0}
+
+$WT = \ conrep -> case conrep of conrep { __DEFAULT -> T conrep }
+
+$wf = \ ww -> case ww of ww1 { __DEFAULT -> (# ww1 #) }
+
+f = \ ds ->
+ case ds of { T ww -> case $wf ww of { (# ww1 #) -> Box ww1 } }
+
diff --git a/testsuite/tests/stranal/sigs/T16859.stderr b/testsuite/tests/stranal/sigs/T16859.stderr
index 6dd199c07c..afd96a8000 100644
--- a/testsuite/tests/stranal/sigs/T16859.stderr
+++ b/testsuite/tests/stranal/sigs/T16859.stderr
@@ -27,10 +27,10 @@ T16859.n_uniq: 1
==================== Strictness signatures ====================
T16859.bar: <1!A><L>
-T16859.baz: <L><1!P(L)><1C1(L)>
+T16859.baz: <1L><1!P(L)><1C1(L)>
T16859.buz: <1!P(L,L)>
-T16859.foo: <L><L>
-T16859.mkInternalName: <1!P(L)><L><L>
+T16859.foo: <1L><L>
+T16859.mkInternalName: <1!P(L)><1L><1L>
T16859.n_loc: <1!P(A,A,A,1L)>
T16859.n_occ: <1!P(A,1!P(L,L),A,A)>
T16859.n_sort: <1!P(1L,A,A,A)>
diff --git a/testsuite/tests/stranal/sigs/all.T b/testsuite/tests/stranal/sigs/all.T
index 3782fa97a6..3ebfe287ec 100644
--- a/testsuite/tests/stranal/sigs/all.T
+++ b/testsuite/tests/stranal/sigs/all.T
@@ -23,7 +23,7 @@ test('T13380c', expect_broken('!3014'), compile, [''])
test('T13380f', normal, compile, [''])
test('T18086', normal, compile, ['-package ghc'])
test('T18957', normal, compile, [''])
-test('T16197b', normal, compile, [''])
+test('T16197b', [grep_errmsg('\$wf')], compile, ['-ddump-simpl -dsuppress-uniques -dsuppress-all'])
test('T19407', normal, compile, [''])
test('T19871', normal, compile, [''])
test('T16859', normal, compile, ['-package ghc'])