diff options
author | Joachim Breitner <mail@joachim-breitner.de> | 2016-07-06 15:44:18 +0200 |
---|---|---|
committer | Joachim Breitner <mail@joachim-breitner.de> | 2016-07-12 13:27:34 +0200 |
commit | 45d8f4eb2bf2fcb103517d064e7ba1e491a66f4c (patch) | |
tree | a8bcd92fa9487a76db46383a0d978001c19ebf39 /testsuite/tests | |
parent | 372dbc4e78abfb6b5d72c0fea27a1c858c5cd797 (diff) | |
download | haskell-45d8f4eb2bf2fcb103517d064e7ba1e491a66f4c.tar.gz |
Demand analyser: Implement LetUp rule (#12370)
This makes the implementation match the description in the paper more
closely: There, a let binding that is not a function has first its body
analised, and then the binding’s RHS. This way, the demand on the bound
variable by the body can be fed into the RHS, yielding more precise
results.
Performance measurements do unfortunately not show significant
improvements or regessions.
Differential Revision: https://phabricator.haskell.org/D2395
Diffstat (limited to 'testsuite/tests')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/spec-inline.stderr | 2 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/T12370.hs | 12 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/T12370.stderr | 14 | ||||
-rw-r--r-- | testsuite/tests/stranal/sigs/all.T | 1 |
4 files changed, 28 insertions, 1 deletions
diff --git a/testsuite/tests/simplCore/should_compile/spec-inline.stderr b/testsuite/tests/simplCore/should_compile/spec-inline.stderr index 64bf015a26..732265a8f6 100644 --- a/testsuite/tests/simplCore/should_compile/spec-inline.stderr +++ b/testsuite/tests/simplCore/should_compile/spec-inline.stderr @@ -43,7 +43,7 @@ Rec { -- RHS size: {terms: 55, types: 9, coercions: 0} Roman.foo_$s$wgo [Occ=LoopBreaker] :: GHC.Prim.Int# -> GHC.Prim.Int# -> GHC.Prim.Int# -[GblId, Arity=2, Caf=NoCafRefs, Str=<L,U><S,U>] +[GblId, Arity=2, Caf=NoCafRefs, Str=<S,U><S,U>] Roman.foo_$s$wgo = \ (sc :: GHC.Prim.Int#) (sc1 :: GHC.Prim.Int#) -> let { diff --git a/testsuite/tests/stranal/sigs/T12370.hs b/testsuite/tests/stranal/sigs/T12370.hs new file mode 100644 index 0000000000..8eff4ae7fe --- /dev/null +++ b/testsuite/tests/stranal/sigs/T12370.hs @@ -0,0 +1,12 @@ +module T12370 where + +foo :: (Int, Int) -> Int +foo (x,y) = x + y +{-# NOINLINE foo #-} + +-- If the p is processed by LetUp, then we get nice use-once demands on n and m +bar n m = + let p = (n,m) + {-# NOINLINE p #-} + in foo p + diff --git a/testsuite/tests/stranal/sigs/T12370.stderr b/testsuite/tests/stranal/sigs/T12370.stderr new file mode 100644 index 0000000000..f8cb839436 --- /dev/null +++ b/testsuite/tests/stranal/sigs/T12370.stderr @@ -0,0 +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 + + + +==================== 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 + + diff --git a/testsuite/tests/stranal/sigs/all.T b/testsuite/tests/stranal/sigs/all.T index d5689afece..f28cda7b89 100644 --- a/testsuite/tests/stranal/sigs/all.T +++ b/testsuite/tests/stranal/sigs/all.T @@ -15,3 +15,4 @@ test('FacState', expect_broken(1600), compile, ['']) test('UnsatFun', normal, compile, ['']) test('BottomFromInnerLambda', normal, compile, ['']) test('DmdAnalGADTs', normal, compile, ['']) +test('T12370', normal, compile, ['']) |