diff options
author | Andreas Klebinger <klebinger.andreas@gmx.at> | 2022-06-27 17:46:30 +0200 |
---|---|---|
committer | Andreas Klebinger <klebinger.andreas@gmx.at> | 2022-06-30 15:59:21 +0200 |
commit | 53b9c4566bcb4439fca6d4b545a9e6fba5c09e0c (patch) | |
tree | 863f3924656adfa8dc02e9940a0ba3da0bd1dbb1 /testsuite/tests/stranal | |
parent | d3d3d508b5a599634678c9e2cd4b1e6cc9e8ca72 (diff) | |
download | haskell-53b9c4566bcb4439fca6d4b545a9e6fba5c09e0c.tar.gz |
Don't mark lambda binders as OtherConwip/andreask/othercon_94
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]
(cherry picked from commit ac7a7fc88b51f9fb4e84499397e12eb0081ba79e)
-------------------------
Metric Decrease:
T12425
T13035
T18223
T18223
T18923
MultiLayerModulesTH_OneShot
Metric Increase:
T18223
WWRec
-------------------------
Diffstat (limited to 'testsuite/tests/stranal')
-rw-r--r-- | testsuite/tests/stranal/should_compile/T20817.stderr | 8 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_compile/all.T | 3 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/T16197b.hs | 5 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/T16197b.stderr | 35 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/T16859.stderr | 6 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/all.T | 2 |
6 files changed, 31 insertions, 28 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/should_compile/all.T b/testsuite/tests/stranal/should_compile/all.T index 47d2130346..365cc940c9 100644 --- a/testsuite/tests/stranal/should_compile/all.T +++ b/testsuite/tests/stranal/should_compile/all.T @@ -30,9 +30,10 @@ test('T8743', [], multimod_compile, ['T8743', '-v0']) test('T10482', [ grep_errmsg(r'wfoo.*Int#') ], compile, ['-dppr-cols=200 -ddump-simpl']) test('T10482a', [ grep_errmsg(r'wf.*Int#') ], compile, ['-dppr-cols=200 -ddump-simpl']) -test('T9208', when(compiler_debugged(), expect_broken(9208)), compile, ['']) +test('T9208', normal, compile_fail, ['-dno-typeable-binds -dstg-lint']) # T9208 fails (and should do so) if you have assertion checking on in the compiler # Hence the above expect_broken. See comments in the ticket +# AK 06/2022: StgLint now also catches this test('T10694', [ grep_errmsg(r'(Str|Cpr)=') ], compile, ['-dppr-cols=200 -ddump-simpl -dsuppress-uniques']) test('T11770', [ check_errmsg('OneShot') ], compile, ['-ddump-simpl']) 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 ec45df4202..88988c266b 100644 --- a/testsuite/tests/stranal/sigs/T16197b.stderr +++ b/testsuite/tests/stranal/sigs/T16197b.stderr @@ -1,30 +1,29 @@ ==================== Strictness signatures ==================== -T16197b.$tc'Box: -T16197b.$tc'T: -T16197b.$tcBox: -T16197b.$tcT: -T16197b.$trModule: -T16197b.f: <1!P(L)> +f: <1!P(L)> ==================== Cpr signatures ==================== -T16197b.$tc'Box: -T16197b.$tc'T: -T16197b.$tcBox: -T16197b.$tcT: -T16197b.$trModule: -T16197b.f: 1 +f: 1 ==================== Strictness signatures ==================== -T16197b.$tc'Box: -T16197b.$tc'T: -T16197b.$tcBox: -T16197b.$tcT: -T16197b.$trModule: -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 37718134a2..de26a53dc1 100644 --- a/testsuite/tests/stranal/sigs/T16859.stderr +++ b/testsuite/tests/stranal/sigs/T16859.stderr @@ -45,10 +45,10 @@ T16859.$tcName: T16859.$tcNameSort: T16859.$trModule: 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 876d2242d8..afba33c088 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']) |