diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2018-12-12 17:22:07 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2018-12-12 17:38:25 +0000 |
commit | d77501cd5b9060e38acd50e11e0c5aae89d75b65 (patch) | |
tree | a6cba21b5adb5c04b476c92bf33436bd1a880981 /testsuite/tests/stranal | |
parent | ded4a1db4d61b1bc8b5fd73e8eb87cf572efda35 (diff) | |
download | haskell-d77501cd5b9060e38acd50e11e0c5aae89d75b65.tar.gz |
Improvements to demand analysis
This patch collects a few improvements triggered by Trac #15696,
and fixing Trac #16029
* Stop making toCleanDmd behave specially for unlifted types.
This special case was the cause of stupid behaviour in Trac
#16029. And to my joy I discovered the let/app invariant
rendered it unnecessary. (Maybe the special case pre-dated
the let/app invariant.)
Result: less special-case handling in the compiler, and
better perf for the compiled code.
* In WwLib.mkWWstr_one, treat seqDmd like U(AAA). It was not
being so treated before, which again led to stupid code.
* Update and improve Notes
There are .stderr test wibbles because we get slightly different
strictness signatures for an argumment of unlifted type:
<L,U> rather than <S,U> for Int#
<S,U> rather than <S(S),U(U)> for Int
Diffstat (limited to 'testsuite/tests/stranal')
-rw-r--r-- | testsuite/tests/stranal/should_compile/Makefile | 5 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_compile/T16029.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_compile/T16029.stdout | 11 | ||||
-rw-r--r-- | testsuite/tests/stranal/should_compile/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/HyperStrUse.stderr | 4 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/T12370.stderr | 8 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/T8598.stderr | 4 |
7 files changed, 38 insertions, 8 deletions
diff --git a/testsuite/tests/stranal/should_compile/Makefile b/testsuite/tests/stranal/should_compile/Makefile index 16d1f2f84a..7ad39442bb 100644 --- a/testsuite/tests/stranal/should_compile/Makefile +++ b/testsuite/tests/stranal/should_compile/Makefile @@ -5,3 +5,8 @@ include $(TOP)/mk/test.mk T13031: echo hello '$(TEST_HC)' $(TEST_HC_OPTS) -c -fforce-recomp T13031.hs -ddump-simpl | grep 'Arity=' + +# Trying to make sure the workers for g1 and g2 +# take only one Int# argument +T16029: + '$(TEST_HC)' $(TEST_HC_OPTS) -c -O -fforce-recomp T16029.hs -dsuppress-uniques -ddump-simpl | grep '::.*Int' diff --git a/testsuite/tests/stranal/should_compile/T16029.hs b/testsuite/tests/stranal/should_compile/T16029.hs new file mode 100644 index 0000000000..b63414f59f --- /dev/null +++ b/testsuite/tests/stranal/should_compile/T16029.hs @@ -0,0 +1,12 @@ +module T16029 where + +data S = MkS Int Int + +g1 :: S -> Int -> Int +g1 (MkS x y) 0 = 0 +g1 (MkS x y) n = g1 (MkS y x) (n-1) + +data T = MkT !Int !Int +g2 :: T -> Int -> Int +g2 (MkT x y) 0 = 0 +g2 (MkT x y) n = g2 (MkT y x) (n-1) diff --git a/testsuite/tests/stranal/should_compile/T16029.stdout b/testsuite/tests/stranal/should_compile/T16029.stdout new file mode 100644 index 0000000000..c06ac7c8b3 --- /dev/null +++ b/testsuite/tests/stranal/should_compile/T16029.stdout @@ -0,0 +1,11 @@ +T16029.$WMkT [InlPrag=INLINE[2]] :: Int -> Int -> T + Tmpl= \ (dt [Occ=Once!] :: Int) (dt [Occ=Once!] :: Int) -> + = \ (dt [Occ=Once!] :: Int) (dt [Occ=Once!] :: Int) -> + :: GHC.Prim.Int# -> GHC.Prim.Int# + = \ (ww :: GHC.Prim.Int#) -> +g2 [InlPrag=NOUSERINLINE[2]] :: T -> Int -> Int + Tmpl= \ (w [Occ=Once!] :: T) (w1 [Occ=Once!] :: Int) -> + = \ (w :: T) (w1 :: Int) -> +g1 [InlPrag=NOUSERINLINE[2]] :: S -> Int -> Int + Tmpl= \ (w [Occ=Once!] :: S) (w1 [Occ=Once!] :: Int) -> + = \ (w :: S) (w1 :: Int) -> diff --git a/testsuite/tests/stranal/should_compile/all.T b/testsuite/tests/stranal/should_compile/all.T index a2aa1d51a9..38c15f2b30 100644 --- a/testsuite/tests/stranal/should_compile/all.T +++ b/testsuite/tests/stranal/should_compile/all.T @@ -47,3 +47,5 @@ test('T13077a', normal, compile, ['']) # The idea is to check that both $wmutVar and $warray # don't mention MutVar# and Array# anymore. test('T15627', [ grep_errmsg(r'(wmutVar|warray).*Int#') ], compile, ['-dppr-cols=200 -ddump-simpl']) + +test('T16029', normal, run_command, ['$MAKE -s --no-print-directory T16029']) diff --git a/testsuite/tests/stranal/sigs/HyperStrUse.stderr b/testsuite/tests/stranal/sigs/HyperStrUse.stderr index 21077d243f..84d81f3a8b 100644 --- a/testsuite/tests/stranal/sigs/HyperStrUse.stderr +++ b/testsuite/tests/stranal/sigs/HyperStrUse.stderr @@ -1,12 +1,12 @@ ==================== Strictness signatures ==================== HyperStrUse.$trModule: m -HyperStrUse.f: <S(S(S)L),1*U(1*U(U),A)><S,1*U>m +HyperStrUse.f: <S(SL),1*U(1*U(U),A)><S,1*U>m ==================== Strictness signatures ==================== HyperStrUse.$trModule: m -HyperStrUse.f: <S(S(S)L),1*U(1*U(U),A)><S,1*U>m +HyperStrUse.f: <S(SL),1*U(1*U(U),A)><S,1*U>m diff --git a/testsuite/tests/stranal/sigs/T12370.stderr b/testsuite/tests/stranal/sigs/T12370.stderr index f8cb839436..d1acdf0b50 100644 --- a/testsuite/tests/stranal/sigs/T12370.stderr +++ b/testsuite/tests/stranal/sigs/T12370.stderr @@ -1,14 +1,14 @@ ==================== Strictness signatures ==================== T12370.$trModule: m -T12370.bar: <S(S),1*U(U)><S(S),1*U(U)>m -T12370.foo: <S(S(S)S(S)),1*U(1*U(U),1*U(U))>m +T12370.bar: <S,1*U(U)><S,1*U(U)>m +T12370.foo: <S(SS),1*U(1*U(U),1*U(U))>m ==================== Strictness signatures ==================== T12370.$trModule: m -T12370.bar: <S(S),1*U(U)><S(S),1*U(U)>m -T12370.foo: <S(S(S)S(S)),1*U(1*U(U),1*U(U))>m +T12370.bar: <S,1*U(U)><S,1*U(U)>m +T12370.foo: <S(SS),1*U(1*U(U),1*U(U))>m diff --git a/testsuite/tests/stranal/sigs/T8598.stderr b/testsuite/tests/stranal/sigs/T8598.stderr index c084e15a99..9bf10d94f4 100644 --- a/testsuite/tests/stranal/sigs/T8598.stderr +++ b/testsuite/tests/stranal/sigs/T8598.stderr @@ -1,12 +1,12 @@ ==================== Strictness signatures ==================== T8598.$trModule: m -T8598.fun: <S(S),1*U(U)>m +T8598.fun: <S,1*U(U)>m ==================== Strictness signatures ==================== T8598.$trModule: m -T8598.fun: <S(S),1*U(U)>m +T8598.fun: <S,1*U(U)>m |