From 0aec78b6c97cee58ba20bfcb959f1369b80c4e4c Mon Sep 17 00:00:00 2001 From: Sebastian Graf Date: Fri, 30 Oct 2020 17:20:37 +0100 Subject: Demand: Interleave usage and strictness demands (#18903) As outlined in #18903, interleaving usage and strictness demands not only means a more compact demand representation, but also allows us to express demands that we weren't easily able to express before. Call demands are *relative* in the sense that a call demand `Cn(cd)` on `g` says "`g` is called `n` times. *Whenever `g` is called*, the result is used according to `cd`". Example from #18903: ```hs h :: Int -> Int h m = let g :: Int -> (Int,Int) g 1 = (m, 0) g n = (2 * n, 2 `div` n) {-# NOINLINE g #-} in case m of 1 -> 0 2 -> snd (g m) _ -> uncurry (+) (g m) ``` Without the interleaved representation, we would just get `L` for the strictness demand on `g`. Now we are able to express that whenever `g` is called, its second component is used strictly in denoting `g` by `1C1(P(1P(U),SP(U)))`. This would allow Nested CPR to unbox the division, for example. Fixes #18903. While fixing regressions, I also discovered and fixed #18957. Metric Decrease: T13253-spj --- .../tests/arityanal/should_compile/Arity01.stderr | 8 +- .../tests/arityanal/should_compile/Arity02.stderr | 4 +- .../tests/arityanal/should_compile/Arity03.stderr | 10 +- .../tests/arityanal/should_compile/Arity04.stderr | 10 +- .../tests/arityanal/should_compile/Arity05.stderr | 12 +-- .../tests/arityanal/should_compile/Arity09.stderr | 2 +- .../tests/arityanal/should_compile/Arity11.stderr | 16 +-- .../tests/arityanal/should_compile/Arity14.stderr | 14 +-- .../tests/arityanal/should_compile/Arity16.stderr | 4 +- .../tests/arityanal/should_compile/T18793.stderr | 16 +-- .../tests/deSugar/should_compile/T2431.stderr | 2 +- testsuite/tests/ghci/linking/T11531.stderr | 2 +- .../tests/numeric/should_compile/T14465.stdout | 2 +- .../tests/numeric/should_compile/T7116.stdout | 8 +- testsuite/tests/perf/compiler/all.T | 1 + .../tests/simplCore/should_compile/EvalTest.stdout | 2 +- .../tests/simplCore/should_compile/T13143.stderr | 8 +- .../tests/simplCore/should_compile/T13543.stderr | 8 +- .../tests/simplCore/should_compile/T18013.stderr | 2 +- .../tests/simplCore/should_compile/T18328.stderr | 33 +++---- .../tests/simplCore/should_compile/T3717.stderr | 4 +- .../tests/simplCore/should_compile/T3772.stdout | 6 +- .../tests/simplCore/should_compile/T4201.stdout | 2 +- .../tests/simplCore/should_compile/T4908.stderr | 6 +- .../tests/simplCore/should_compile/T4930.stderr | 4 +- .../tests/simplCore/should_compile/T7360.stderr | 6 +- .../simplCore/should_compile/noinline01.stderr | 2 +- .../tests/simplCore/should_compile/par01.stderr | 2 +- .../simplCore/should_compile/spec-inline.stderr | 8 +- .../tests/stranal/should_compile/T10694.stderr | 20 ++-- .../tests/stranal/should_compile/T13031.stdout | 2 +- testsuite/tests/stranal/should_compile/T18903.hs | 16 +++ .../tests/stranal/should_compile/T18903.stderr | 109 +++++++++++++++++++++ testsuite/tests/stranal/should_compile/all.T | 3 + .../stranal/sigs/BottomFromInnerLambda.stderr | 8 +- testsuite/tests/stranal/sigs/CaseBinderCPR.stderr | 4 +- testsuite/tests/stranal/sigs/DmdAnalGADTs.stderr | 16 +-- testsuite/tests/stranal/sigs/HyperStrUse.stderr | 4 +- testsuite/tests/stranal/sigs/NewtypeArity.stderr | 8 +- testsuite/tests/stranal/sigs/StrAnalExample.stderr | 4 +- testsuite/tests/stranal/sigs/T12370.stderr | 8 +- testsuite/tests/stranal/sigs/T13380f.stderr | 24 ++--- testsuite/tests/stranal/sigs/T17932.stderr | 4 +- testsuite/tests/stranal/sigs/T18086.stderr | 8 +- testsuite/tests/stranal/sigs/T18957.hs | 31 ++++++ testsuite/tests/stranal/sigs/T18957.stderr | 30 ++++++ testsuite/tests/stranal/sigs/T5075.stderr | 4 +- testsuite/tests/stranal/sigs/T8569.stderr | 4 +- testsuite/tests/stranal/sigs/T8598.stderr | 4 +- testsuite/tests/stranal/sigs/UnsatFun.hs | 3 +- testsuite/tests/stranal/sigs/UnsatFun.stderr | 28 +++--- testsuite/tests/stranal/sigs/all.T | 1 + 52 files changed, 369 insertions(+), 178 deletions(-) create mode 100644 testsuite/tests/stranal/should_compile/T18903.hs create mode 100644 testsuite/tests/stranal/should_compile/T18903.stderr create mode 100644 testsuite/tests/stranal/sigs/T18957.hs create mode 100644 testsuite/tests/stranal/sigs/T18957.stderr (limited to 'testsuite') diff --git a/testsuite/tests/arityanal/should_compile/Arity01.stderr b/testsuite/tests/arityanal/should_compile/Arity01.stderr index 318fc799e0..bdee9d75db 100644 --- a/testsuite/tests/arityanal/should_compile/Arity01.stderr +++ b/testsuite/tests/arityanal/should_compile/Arity01.stderr @@ -10,7 +10,7 @@ F1.f2 = 1 Rec { -- RHS size: {terms: 18, types: 4, coercions: 0, joins: 0/0} F1.f1_h1 [Occ=LoopBreaker] :: Integer -> Integer -> Integer -> Integer -[GblId, Arity=3, Str=, Unf=OtherCon []] +[GblId, Arity=3, Str=, Unf=OtherCon []] F1.f1_h1 = \ (n :: Integer) (x :: Integer) (eta :: Integer) -> case GHC.Num.Integer.integerCompare x n of { @@ -33,7 +33,7 @@ f1 = F1.f1_h1 F1.f3 F1.f2 F1.f3 g :: Integer -> Integer -> Integer -> Integer -> Integer -> Integer [GblId, Arity=5, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=5,unsat_ok=True,boring_ok=False) Tmpl= \ (x1 [Occ=Once1] :: Integer) (x2 [Occ=Once1] :: Integer) (x3 [Occ=Once1] :: Integer) (x4 [Occ=Once1] :: Integer) (x5 [Occ=Once1] :: Integer) -> GHC.Num.Integer.integerAdd (GHC.Num.Integer.integerAdd (GHC.Num.Integer.integerAdd (GHC.Num.Integer.integerAdd x1 x2) x3) x4) x5}] g = \ (x1 :: Integer) (x2 :: Integer) (x3 :: Integer) (x4 :: Integer) (x5 :: Integer) -> GHC.Num.Integer.integerAdd (GHC.Num.Integer.integerAdd (GHC.Num.Integer.integerAdd (GHC.Num.Integer.integerAdd x1 x2) x3) x4) x5 @@ -47,7 +47,7 @@ F1.s1 = 3 s :: forall {t1} {t2}. Num t1 => (t1 -> t2) -> t2 [GblId, Arity=2, - Str=, + Str=<1P(A,A,A,A,A,A,1C1(U))>, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=False) Tmpl= \ (@t) (@t1) ($dNum [Occ=Once1] :: Num t) (f [Occ=Once1!] :: t -> t1) -> f (fromInteger @t $dNum F1.s1)}] s = \ (@t) (@t1) ($dNum :: Num t) (f :: t -> t1) -> f (fromInteger @t $dNum F1.s1) @@ -61,7 +61,7 @@ F1.h1 = 24 h :: Integer -> Integer [GblId, Arity=1, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (x5 [Occ=Once1] :: Integer) -> GHC.Num.Integer.integerAdd F1.h1 x5}] h = \ (x5 :: Integer) -> GHC.Num.Integer.integerAdd F1.h1 x5 diff --git a/testsuite/tests/arityanal/should_compile/Arity02.stderr b/testsuite/tests/arityanal/should_compile/Arity02.stderr index 3bcac9aacc..47754d5944 100644 --- a/testsuite/tests/arityanal/should_compile/Arity02.stderr +++ b/testsuite/tests/arityanal/should_compile/Arity02.stderr @@ -11,7 +11,7 @@ F2.f1 = 0 f2f :: forall {t1} {t2}. (t1 -> Integer -> t2) -> t1 -> t2 [GblId, Arity=2, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=True) Tmpl= \ (@t) (@t1) (h [Occ=Once1!] :: t -> Integer -> t1) (x [Occ=Once1] :: t) -> h x F2.f1}] f2f = \ (@t) (@t1) (h :: t -> Integer -> t1) (x :: t) -> h x F2.f1 @@ -24,7 +24,7 @@ lvl = 1 Rec { -- RHS size: {terms: 16, types: 3, coercions: 0, joins: 0/0} F2.f2_g [Occ=LoopBreaker] :: Integer -> Integer -> Integer -[GblId, Arity=2, Str=, Unf=OtherCon []] +[GblId, Arity=2, Str=, Unf=OtherCon []] F2.f2_g = \ (x :: Integer) (y :: Integer) -> case GHC.Num.Integer.integerCompare x F2.f1 of { diff --git a/testsuite/tests/arityanal/should_compile/Arity03.stderr b/testsuite/tests/arityanal/should_compile/Arity03.stderr index 29432b7307..fde8e3fa44 100644 --- a/testsuite/tests/arityanal/should_compile/Arity03.stderr +++ b/testsuite/tests/arityanal/should_compile/Arity03.stderr @@ -4,8 +4,8 @@ Result size of Tidy Core = {terms: 29, types: 13, coercions: 0, joins: 0/0} Rec { -- RHS size: {terms: 15, types: 3, coercions: 0, joins: 0/0} -F3.$wfac [InlPrag=NOUSERINLINE[2], Occ=LoopBreaker] :: GHC.Prim.Int# -> GHC.Prim.Int# -[GblId, Arity=1, Str=, Unf=OtherCon []] +F3.$wfac [InlPrag=[2], Occ=LoopBreaker] :: GHC.Prim.Int# -> GHC.Prim.Int# +[GblId, Arity=1, Str=, Unf=OtherCon []] F3.$wfac = \ (ww :: GHC.Prim.Int#) -> case ww of wild { @@ -15,10 +15,10 @@ F3.$wfac end Rec } -- RHS size: {terms: 10, types: 4, coercions: 0, joins: 0/0} -fac [InlPrag=NOUSERINLINE[2]] :: Int -> Int +fac [InlPrag=[2]] :: Int -> Int [GblId, Arity=1, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (w [Occ=Once1!] :: Int) -> case w of { GHC.Types.I# ww1 [Occ=Once1] -> case F3.$wfac ww1 of ww2 [Occ=Once1] { __DEFAULT -> GHC.Types.I# ww2 } }}] @@ -28,7 +28,7 @@ fac = \ (w :: Int) -> case w of { GHC.Types.I# ww1 -> case F3.$wfac ww1 of ww2 { f3 :: Int -> Int [GblId, Arity=1, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True) Tmpl= fac}] diff --git a/testsuite/tests/arityanal/should_compile/Arity04.stderr b/testsuite/tests/arityanal/should_compile/Arity04.stderr index 5e05c7407d..dd67adb572 100644 --- a/testsuite/tests/arityanal/should_compile/Arity04.stderr +++ b/testsuite/tests/arityanal/should_compile/Arity04.stderr @@ -6,7 +6,7 @@ Result size of Tidy Core = {terms: 39, types: 24, coercions: 0, joins: 0/0} f4g :: Int -> Int [GblId, Arity=1, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (y [Occ=Once1!] :: Int) -> case y of { GHC.Types.I# x [Occ=Once1] -> GHC.Types.I# (GHC.Prim.+# x 1#) }}] @@ -19,8 +19,8 @@ lvl = GHC.Types.I# 0# Rec { -- RHS size: {terms: 13, types: 4, coercions: 0, joins: 0/0} -F4.$wf4h [InlPrag=NOUSERINLINE[2], Occ=LoopBreaker] :: (Int -> Int) -> GHC.Prim.Int# -> Int -[GblId, Arity=2, Str=, Unf=OtherCon []] +F4.$wf4h [InlPrag=[2], Occ=LoopBreaker] :: (Int -> Int) -> GHC.Prim.Int# -> Int +[GblId, Arity=2, Str=, Unf=OtherCon []] F4.$wf4h = \ (w :: Int -> Int) (ww :: GHC.Prim.Int#) -> case ww of wild { @@ -30,10 +30,10 @@ F4.$wf4h end Rec } -- RHS size: {terms: 8, types: 5, coercions: 0, joins: 0/0} -f4h [InlPrag=NOUSERINLINE[2]] :: (Int -> Int) -> Int -> Int +f4h [InlPrag=[2]] :: (Int -> Int) -> Int -> Int [GblId, Arity=2, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=False) Tmpl= \ (w [Occ=Once1] :: Int -> Int) (w1 [Occ=Once1!] :: Int) -> case w1 of { GHC.Types.I# ww1 [Occ=Once1] -> F4.$wf4h w ww1 }}] f4h = \ (w :: Int -> Int) (w1 :: Int) -> case w1 of { GHC.Types.I# ww1 -> F4.$wf4h w ww1 } diff --git a/testsuite/tests/arityanal/should_compile/Arity05.stderr b/testsuite/tests/arityanal/should_compile/Arity05.stderr index ccdba513af..4a4ac74a9f 100644 --- a/testsuite/tests/arityanal/should_compile/Arity05.stderr +++ b/testsuite/tests/arityanal/should_compile/Arity05.stderr @@ -11,21 +11,21 @@ F5.f5g1 = 1 f5g :: forall {a} {t}. Num a => (t -> a) -> t -> a [GblId, Arity=3, - Str=, + Str=<1C1(U)>, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=3,unsat_ok=True,boring_ok=False) Tmpl= \ (@a) (@t) ($dNum :: Num a) (h [Occ=Once1!] :: t -> a) (z [Occ=Once1] :: t) -> + @a $dNum (h z) (fromInteger @a $dNum F5.f5g1)}] f5g = \ (@a) (@t) ($dNum :: Num a) (h :: t -> a) (z :: t) -> + @a $dNum (h z) (fromInteger @a $dNum F5.f5g1) -- RHS size: {terms: 15, types: 14, coercions: 0, joins: 0/0} -F5.$wf5h [InlPrag=NOUSERINLINE[2]] :: forall {a} {t}. (a -> a -> a) -> (Integer -> a) -> (t -> a) -> t -> (t -> a) -> a -[GblId, Arity=5, Str=, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 60 60 0 60] 120 0}] +F5.$wf5h [InlPrag=[2]] :: forall {a} {t}. (a -> a -> a) -> (Integer -> a) -> (t -> a) -> t -> (t -> a) -> a +[GblId, Arity=5, Str=<1C1(U)><1C1(U)><1C1(U)>, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 60 60 0 60] 120 0}] F5.$wf5h = \ (@a) (@t) (ww :: a -> a -> a) (ww1 :: Integer -> a) (w :: t -> a) (w1 :: t) (w2 :: t -> a) -> ww (w w1) (ww (w2 w1) (ww1 F5.f5g1)) -- RHS size: {terms: 15, types: 32, coercions: 0, joins: 0/0} -f5h [InlPrag=NOUSERINLINE[2]] :: forall {a} {t}. Num a => (t -> a) -> t -> (t -> a) -> a +f5h [InlPrag=[2]] :: forall {a} {t}. Num a => (t -> a) -> t -> (t -> a) -> a [GblId, Arity=4, - Str=, + Str=<1C1(U)><1C1(U)>, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=4,unsat_ok=True,boring_ok=False) Tmpl= \ (@a) (@t) (w [Occ=Once1!] :: Num a) (w1 [Occ=Once1] :: t -> a) (w2 [Occ=Once1] :: t) (w3 [Occ=Once1] :: t -> a) -> case w of { GHC.Num.C:Num ww1 [Occ=Once1] _ [Occ=Dead] _ [Occ=Dead] _ [Occ=Dead] _ [Occ=Dead] _ [Occ=Dead] ww7 [Occ=Once1] -> F5.$wf5h @a @t ww1 ww7 w1 w2 w3 }}] f5h = \ (@a) (@t) (w :: Num a) (w1 :: t -> a) (w2 :: t) (w3 :: t -> a) -> case w of { GHC.Num.C:Num ww1 ww2 ww3 ww4 ww5 ww6 ww7 -> F5.$wf5h @a @t ww1 ww7 w1 w2 w3 } @@ -34,7 +34,7 @@ f5h = \ (@a) (@t) (w :: Num a) (w1 :: t -> a) (w2 :: t) (w3 :: t -> a) -> case w f5y :: Integer -> Integer [GblId, Arity=1, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (y [Occ=Once1] :: Integer) -> GHC.Num.Integer.integerAdd y F5.f5g1}] f5y = \ (y :: Integer) -> GHC.Num.Integer.integerAdd y F5.f5g1 diff --git a/testsuite/tests/arityanal/should_compile/Arity09.stderr b/testsuite/tests/arityanal/should_compile/Arity09.stderr index 580483309f..8075f7b17e 100644 --- a/testsuite/tests/arityanal/should_compile/Arity09.stderr +++ b/testsuite/tests/arityanal/should_compile/Arity09.stderr @@ -20,7 +20,7 @@ F9.f1 = 10 Rec { -- RHS size: {terms: 15, types: 2, coercions: 0, joins: 0/0} F9.f91_f [Occ=LoopBreaker] :: Integer -> Integer -[GblId, Arity=1, Str=, Unf=OtherCon []] +[GblId, Arity=1, Str=, Unf=OtherCon []] F9.f91_f = \ (n :: Integer) -> case GHC.Num.Integer.integerCompare n lvl of { diff --git a/testsuite/tests/arityanal/should_compile/Arity11.stderr b/testsuite/tests/arityanal/should_compile/Arity11.stderr index 243632ea06..77c790ae7b 100644 --- a/testsuite/tests/arityanal/should_compile/Arity11.stderr +++ b/testsuite/tests/arityanal/should_compile/Arity11.stderr @@ -20,7 +20,7 @@ F11.fib2 = 2 Rec { -- RHS size: {terms: 24, types: 3, coercions: 0, joins: 0/0} F11.f11_fib [Occ=LoopBreaker] :: Integer -> Integer -[GblId, Arity=1, Str=, Unf=OtherCon []] +[GblId, Arity=1, Str=, Unf=OtherCon []] F11.f11_fib = \ (ds :: Integer) -> case GHC.Num.Integer.integerEq# ds F11.fib1 of { @@ -34,8 +34,8 @@ F11.f11_fib end Rec } -- RHS size: {terms: 52, types: 28, coercions: 0, joins: 0/5} -F11.$wfib [InlPrag=NOUSERINLINE[2]] :: forall {a} {p}. (a -> a -> Bool) -> (Num a, Num p) => a -> p -[GblId, Arity=4, Str=, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 150 60 0] 460 0}] +F11.$wfib [InlPrag=[2]] :: forall {a} {p}. (a -> a -> Bool) -> (Num a, Num p) => a -> p +[GblId, Arity=4, Str=, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 150 60 0] 460 0}] F11.$wfib = \ (@a) (@p) (ww :: a -> a -> Bool) (w :: Num a) (w1 :: Num p) (w2 :: a) -> let { @@ -56,7 +56,7 @@ F11.$wfib lvl3 = fromInteger @a w F11.fib1 } in letrec { fib4 [Occ=LoopBreaker] :: a -> p - [LclId, Arity=1, Str=, Unf=OtherCon []] + [LclId, Arity=1, Str=, Unf=OtherCon []] fib4 = \ (ds :: a) -> case ww ds lvl3 of { @@ -70,10 +70,10 @@ F11.$wfib fib4 w2 -- RHS size: {terms: 14, types: 21, coercions: 0, joins: 0/0} -fib [InlPrag=NOUSERINLINE[2]] :: forall {a} {p}. (Eq a, Num a, Num p) => a -> p +fib [InlPrag=[2]] :: forall {a} {p}. (Eq a, Num a, Num p) => a -> p [GblId, Arity=4, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=4,unsat_ok=True,boring_ok=False) Tmpl= \ (@a) (@p) (w [Occ=Once1!] :: Eq a) (w1 [Occ=Once1] :: Num a) (w2 [Occ=Once1] :: Num p) (w3 [Occ=Once1] :: a) -> case w of { GHC.Classes.C:Eq ww1 [Occ=Once1] _ [Occ=Dead] -> F11.$wfib @a @p ww1 w1 w2 w3 }}] fib = \ (@a) (@p) (w :: Eq a) (w1 :: Num a) (w2 :: Num p) (w3 :: a) -> case w of { GHC.Classes.C:Eq ww1 ww2 -> F11.$wfib @a @p ww1 w1 w2 w3 } @@ -92,7 +92,7 @@ F11.f11_x = F11.f11_fib F11.f3 F11.f11f1 :: Integer -> Integer [GblId, Arity=1, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (y [Occ=Once1] :: Integer) -> GHC.Num.Integer.integerAdd F11.f11_x y}] F11.f11f1 = \ (y :: Integer) -> GHC.Num.Integer.integerAdd F11.f11_x y @@ -101,7 +101,7 @@ F11.f11f1 = \ (y :: Integer) -> GHC.Num.Integer.integerAdd F11.f11_x y f11f :: forall {p}. p -> Integer -> Integer [GblId, Arity=2, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True) Tmpl= \ (@p) _ [Occ=Dead] (eta [Occ=Once1] :: Integer) -> F11.f11f1 eta}] f11f = \ (@p) _ [Occ=Dead] -> F11.f11f1 diff --git a/testsuite/tests/arityanal/should_compile/Arity14.stderr b/testsuite/tests/arityanal/should_compile/Arity14.stderr index 1d4ea800e6..1a5fdc38c3 100644 --- a/testsuite/tests/arityanal/should_compile/Arity14.stderr +++ b/testsuite/tests/arityanal/should_compile/Arity14.stderr @@ -6,7 +6,7 @@ Result size of Tidy Core = {terms: 56, types: 87, coercions: 0, joins: 0/3} F14.f1 :: forall {t}. t -> t [GblId, Arity=1, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True) Tmpl= \ (@t) (y [Occ=Once1] :: t) -> y}] F14.f1 = \ (@t) (y :: t) -> y @@ -17,8 +17,8 @@ F14.f2 :: Integer F14.f2 = 1 -- RHS size: {terms: 35, types: 24, coercions: 0, joins: 0/3} -F14.$wf14 [InlPrag=NOUSERINLINE[2]] :: forall {t}. (t -> t -> Bool) -> Num t => t -> t -> t -> t -[GblId, Arity=4, Str=, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 90 0 0] 300 0}] +F14.$wf14 [InlPrag=[2]] :: forall {t}. (t -> t -> Bool) -> Num t => t -> t -> t -> t +[GblId, Arity=4, Str=, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 90 0 0] 300 0}] F14.$wf14 = \ (@t) (ww :: t -> t -> Bool) (w :: Num t) (w1 :: t) (w2 :: t) -> let { @@ -27,14 +27,14 @@ F14.$wf14 lvl = fromInteger @t w F14.f2 } in letrec { f3 [Occ=LoopBreaker] :: t -> t -> t -> t - [LclId, Arity=2, Str=, Unf=OtherCon []] + [LclId, Arity=2, Str=, Unf=OtherCon []] f3 = \ (n :: t) (x :: t) -> case ww x n of { False -> F14.f1 @t; True -> let { - v [Dmd=] :: t -> t + v [Dmd=UCU(U)] :: t -> t [LclId] v = f3 n (+ @t w x lvl) } in \ (y :: t) -> v (+ @t w x y) @@ -42,10 +42,10 @@ F14.$wf14 f3 w1 w2 -- RHS size: {terms: 13, types: 34, coercions: 0, joins: 0/0} -f14 [InlPrag=NOUSERINLINE[2]] :: forall {t}. (Ord t, Num t) => t -> t -> t -> t +f14 [InlPrag=[2]] :: forall {t}. (Ord t, Num t) => t -> t -> t -> t [GblId, Arity=4, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=4,unsat_ok=True,boring_ok=False) Tmpl= \ (@t) (w [Occ=Once1!] :: Ord t) (w1 [Occ=Once1] :: Num t) (w2 [Occ=Once1] :: t) (w3 [Occ=Once1] :: t) -> case w of { GHC.Classes.C:Ord _ [Occ=Dead] _ [Occ=Dead] ww3 [Occ=Once1] _ [Occ=Dead] _ [Occ=Dead] _ [Occ=Dead] _ [Occ=Dead] _ [Occ=Dead] -> F14.$wf14 @t ww3 w1 w2 w3 }}] f14 = \ (@t) (w :: Ord t) (w1 :: Num t) (w2 :: t) (w3 :: t) -> case w of { GHC.Classes.C:Ord ww1 ww2 ww3 ww4 ww5 ww6 ww7 ww8 -> F14.$wf14 @t ww3 w1 w2 w3 } diff --git a/testsuite/tests/arityanal/should_compile/Arity16.stderr b/testsuite/tests/arityanal/should_compile/Arity16.stderr index 6c9d7f61f8..3f5b3462c6 100644 --- a/testsuite/tests/arityanal/should_compile/Arity16.stderr +++ b/testsuite/tests/arityanal/should_compile/Arity16.stderr @@ -5,7 +5,7 @@ Result size of Tidy Core = {terms: 52, types: 87, coercions: 0, joins: 0/0} Rec { -- RHS size: {terms: 15, types: 17, coercions: 0, joins: 0/0} map2 [Occ=LoopBreaker] :: forall {t} {a}. (t -> a) -> [t] -> [a] -[GblId, Arity=2, Str=, Unf=OtherCon []] +[GblId, Arity=2, Str=, Unf=OtherCon []] map2 = \ (@t) (@a) (f :: t -> a) (ds :: [t]) -> case ds of { @@ -27,7 +27,7 @@ lvl1 = \ (@a) -> Control.Exception.Base.patError @'GHC.Types.LiftedRep @[a] lvl Rec { -- RHS size: {terms: 29, types: 35, coercions: 0, joins: 0/0} zipWith2 [Occ=LoopBreaker] :: forall {t1} {t2} {a}. (t1 -> t2 -> a) -> [t1] -> [t2] -> [a] -[GblId, Arity=3, Str=, Unf=OtherCon []] +[GblId, Arity=3, Str=, Unf=OtherCon []] zipWith2 = \ (@t) (@t1) (@a) (f :: t -> t1 -> a) (ds :: [t]) (ds1 :: [t1]) -> case ds of { diff --git a/testsuite/tests/arityanal/should_compile/T18793.stderr b/testsuite/tests/arityanal/should_compile/T18793.stderr index 60b2fd784d..c0843f2edc 100644 --- a/testsuite/tests/arityanal/should_compile/T18793.stderr +++ b/testsuite/tests/arityanal/should_compile/T18793.stderr @@ -4,14 +4,14 @@ Result size of Tidy Core = {terms: 81, types: 74, coercions: 0, joins: 0/0} -- RHS size: {terms: 20, types: 13, coercions: 0, joins: 0/0} T18793.$wstuff [InlPrag=NOINLINE] :: Int -> (# Int, [Int] #) -[GblId, Arity=1, Str=, Unf=OtherCon []] +[GblId, Arity=1, Str=, Unf=OtherCon []] T18793.$wstuff = \ (w :: Int) -> (# w, GHC.Types.: @Int (case w of { GHC.Types.I# x -> GHC.Types.I# (GHC.Prim.+# x 1#) }) (GHC.Types.: @Int (case w of { GHC.Types.I# x -> GHC.Types.I# (GHC.Prim.+# x 2#) }) (GHC.Types.[] @Int)) #) -- RHS size: {terms: 8, types: 11, coercions: 0, joins: 0/0} -stuff [InlPrag=NOUSERINLINE[final]] :: Int -> [Int] +stuff [InlPrag=[final]] :: Int -> [Int] [GblId, Arity=1, - Str=, + Str=, Cpr=m2, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) Tmpl= \ (w [Occ=Once1] :: Int) -> case T18793.$wstuff w of { (# ww1 [Occ=Once1], ww2 [Occ=Once1] #) -> GHC.Types.: @Int ww1 ww2 }}] @@ -19,8 +19,8 @@ stuff = \ (w :: Int) -> case T18793.$wstuff w of { (# ww1, ww2 #) -> GHC.Types.: Rec { -- RHS size: {terms: 23, types: 11, coercions: 0, joins: 0/0} -T18793.$wgo1 [InlPrag=NOUSERINLINE[2], Occ=LoopBreaker] :: [Int] -> GHC.Prim.Int# -> GHC.Prim.Int# -[GblId, Arity=2, Str=, Unf=OtherCon []] +T18793.$wgo1 [InlPrag=[2], Occ=LoopBreaker] :: [Int] -> GHC.Prim.Int# -> GHC.Prim.Int# +[GblId, Arity=2, Str=, Unf=OtherCon []] T18793.$wgo1 = \ (w :: [Int]) (ww :: GHC.Prim.Int#) -> case w of { @@ -36,10 +36,10 @@ T18793.$wgo1 end Rec } -- RHS size: {terms: 12, types: 6, coercions: 0, joins: 0/0} -T18793.f_go1 [InlPrag=NOUSERINLINE[2]] :: [Int] -> Int -> Int +T18793.f_go1 [InlPrag=[2]] :: [Int] -> Int -> Int [GblId, Arity=2, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=False) Tmpl= \ (w [Occ=Once1] :: [Int]) (w1 [Occ=Once1!] :: Int) -> case w1 of { GHC.Types.I# ww1 [Occ=Once1] -> case T18793.$wgo1 w ww1 of ww2 [Occ=Once1] { __DEFAULT -> GHC.Types.I# ww2 } }}] @@ -59,7 +59,7 @@ T18793.f1 = case T18793.$wstuff T18793.f2 of { (# ww1, ww2 #) -> GHC.Types.: @In f :: Int -> Int [GblId, Arity=1, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=False) Tmpl= \ (eta [Occ=Once1] :: Int) -> T18793.f_go1 T18793.f1 eta}] diff --git a/testsuite/tests/deSugar/should_compile/T2431.stderr b/testsuite/tests/deSugar/should_compile/T2431.stderr index c44c342f05..86d74c2d35 100644 --- a/testsuite/tests/deSugar/should_compile/T2431.stderr +++ b/testsuite/tests/deSugar/should_compile/T2431.stderr @@ -17,7 +17,7 @@ T2431.$WRefl -- RHS size: {terms: 4, types: 8, coercions: 0, joins: 0/0} absurd :: forall a. (Int :~: Bool) -> a -[GblId, Arity=1, Str=b, Cpr=b, Unf=OtherCon []] +[GblId, Arity=1, Str=b, Cpr=b, Unf=OtherCon []] absurd = \ (@a) (x :: Int :~: Bool) -> case x of { } -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} diff --git a/testsuite/tests/ghci/linking/T11531.stderr b/testsuite/tests/ghci/linking/T11531.stderr index b6527a3268..eb8c154598 100644 --- a/testsuite/tests/ghci/linking/T11531.stderr +++ b/testsuite/tests/ghci/linking/T11531.stderr @@ -1,5 +1,5 @@ -GHC.Linker.Runtime.dynLoadObjs: Loading temp shared object failed +GHC.Linker.Loader.dynLoadObjs: Loading temp shared object failed During interactive linking, GHCi couldn't find the following symbol: This may be due to you not asking GHCi to load extra object files, archives or DLLs needed by your current session. Restart GHCi, specifying diff --git a/testsuite/tests/numeric/should_compile/T14465.stdout b/testsuite/tests/numeric/should_compile/T14465.stdout index 5001d5b3a4..d9287fcd32 100644 --- a/testsuite/tests/numeric/should_compile/T14465.stdout +++ b/testsuite/tests/numeric/should_compile/T14465.stdout @@ -78,7 +78,7 @@ twoTimesTwo = 4 plusOne :: Natural -> Natural [GblId, Arity=1, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) diff --git a/testsuite/tests/numeric/should_compile/T7116.stdout b/testsuite/tests/numeric/should_compile/T7116.stdout index 41995d9734..996d391b44 100644 --- a/testsuite/tests/numeric/should_compile/T7116.stdout +++ b/testsuite/tests/numeric/should_compile/T7116.stdout @@ -43,7 +43,7 @@ T7116.$trModule dr :: Double -> Double [GblId, Arity=1, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, @@ -60,7 +60,7 @@ dr dl :: Double -> Double [GblId, Arity=1, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, @@ -73,7 +73,7 @@ dl = dr fr :: Float -> Float [GblId, Arity=1, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, @@ -92,7 +92,7 @@ fr fl :: Float -> Float [GblId, Arity=1, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index a0440ca173..46222c723a 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -341,6 +341,7 @@ test('Naperian', test ('T9630', [ collect_compiler_residency(15), + collect_compiler_stats('bytes allocated', 2), extra_clean(['T9630a.hi', 'T9630a.o']), ], multimod_compile, diff --git a/testsuite/tests/simplCore/should_compile/EvalTest.stdout b/testsuite/tests/simplCore/should_compile/EvalTest.stdout index b536c541c0..fa65324317 100644 --- a/testsuite/tests/simplCore/should_compile/EvalTest.stdout +++ b/testsuite/tests/simplCore/should_compile/EvalTest.stdout @@ -1 +1 @@ -rght [Dmd=] :: AList a +rght [Dmd=MU] :: AList a diff --git a/testsuite/tests/simplCore/should_compile/T13143.stderr b/testsuite/tests/simplCore/should_compile/T13143.stderr index 73ac2fd1a8..44ab565425 100644 --- a/testsuite/tests/simplCore/should_compile/T13143.stderr +++ b/testsuite/tests/simplCore/should_compile/T13143.stderr @@ -7,7 +7,7 @@ Rec { -- RHS size: {terms: 4, types: 4, coercions: 0, joins: 0/0} T13143.$wf [InlPrag=NOINLINE, Occ=LoopBreaker] :: forall {a}. (# #) -> a -[GblId, Arity=1, Str=b, Cpr=b, Unf=OtherCon []] +[GblId, Arity=1, Str=b, Cpr=b, Unf=OtherCon []] T13143.$wf = \ (@a) _ [Occ=Dead] -> T13143.$wf @a GHC.Prim.(##) end Rec } @@ -15,7 +15,7 @@ end Rec } f [InlPrag=[final]] :: forall a. Int -> a [GblId, Arity=1, - Str=b, + Str=b, Cpr=b, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, @@ -68,7 +68,7 @@ Rec { -- RHS size: {terms: 28, types: 7, coercions: 0, joins: 0/0} T13143.$wg [InlPrag=[2], Occ=LoopBreaker] :: Bool -> Bool -> GHC.Prim.Int# -> GHC.Prim.Int# -[GblId, Arity=3, Str=, Unf=OtherCon []] +[GblId, Arity=3, Str=, Unf=OtherCon []] T13143.$wg = \ (w :: Bool) (w1 :: Bool) (ww :: GHC.Prim.Int#) -> case w of { @@ -89,7 +89,7 @@ end Rec } g [InlPrag=[2]] :: Bool -> Bool -> Int -> Int [GblId, Arity=3, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, diff --git a/testsuite/tests/simplCore/should_compile/T13543.stderr b/testsuite/tests/simplCore/should_compile/T13543.stderr index d7df037ba4..ce5b23ff4a 100644 --- a/testsuite/tests/simplCore/should_compile/T13543.stderr +++ b/testsuite/tests/simplCore/should_compile/T13543.stderr @@ -1,8 +1,8 @@ ==================== Strictness signatures ==================== Foo.$trModule: -Foo.f: -Foo.g: +Foo.f: +Foo.g: @@ -15,7 +15,7 @@ Foo.g: m1 ==================== Strictness signatures ==================== Foo.$trModule: -Foo.f: -Foo.g: +Foo.f: +Foo.g: diff --git a/testsuite/tests/simplCore/should_compile/T18013.stderr b/testsuite/tests/simplCore/should_compile/T18013.stderr index c141780f74..51e30a9f75 100644 --- a/testsuite/tests/simplCore/should_compile/T18013.stderr +++ b/testsuite/tests/simplCore/should_compile/T18013.stderr @@ -136,7 +136,7 @@ mapMaybeRule :: forall a b. Rule IO a b -> Rule IO (Maybe a) (Maybe b) [GblId, Arity=1, - Str=, + Str=, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [20] 150 10}] mapMaybeRule diff --git a/testsuite/tests/simplCore/should_compile/T18328.stderr b/testsuite/tests/simplCore/should_compile/T18328.stderr index ce366ea367..d32f553114 100644 --- a/testsuite/tests/simplCore/should_compile/T18328.stderr +++ b/testsuite/tests/simplCore/should_compile/T18328.stderr @@ -4,19 +4,18 @@ Result size of Tidy Core = {terms: 69, types: 61, coercions: 0, joins: 1/1} -- RHS size: {terms: 42, types: 28, coercions: 0, joins: 1/1} -T18328.$wf [InlPrag=NOUSERINLINE[2]] +T18328.$wf [InlPrag=[2]] :: forall {a}. GHC.Prim.Int# -> [a] -> [a] -> [a] [GblId, Arity=3, - Str=, + Str=, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [182 0 0] 312 0}] T18328.$wf = \ (@a) (ww :: GHC.Prim.Int#) (w :: [a]) (w1 :: [a]) -> join { - $wj [InlPrag=NOINLINE, Dmd=] - :: forall {p}. GHC.Prim.Void# -> [a] - [LclId[JoinId(2)], Arity=1, Str=, Unf=OtherCon []] + $wj [InlPrag=NOINLINE, Dmd=1C1(U)] :: forall {p}. (# #) -> [a] + [LclId[JoinId(2)], Arity=1, Str=, Unf=OtherCon []] $wj (@p) _ [Occ=Dead, OS=OneShot] = case ww of { __DEFAULT -> ++ @a w (++ @a w (++ @a w w1)); @@ -24,24 +23,24 @@ T18328.$wf } } in case ww of { __DEFAULT -> ++ @a w w1; - 1# -> jump $wj @Integer GHC.Prim.void#; - 2# -> jump $wj @Integer GHC.Prim.void#; - 3# -> jump $wj @Integer GHC.Prim.void# + 1# -> jump $wj @Integer GHC.Prim.(##); + 2# -> jump $wj @Integer GHC.Prim.(##); + 3# -> jump $wj @Integer GHC.Prim.(##) } -- RHS size: {terms: 11, types: 10, coercions: 0, joins: 0/0} -f [InlPrag=NOUSERINLINE[2]] :: forall a. Int -> [a] -> [a] -> [a] +f [InlPrag=[2]] :: forall a. Int -> [a] -> [a] -> [a] [GblId, Arity=3, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=3,unsat_ok=True,boring_ok=False) Tmpl= \ (@a) - (w [Occ=Once!] :: Int) - (w1 [Occ=Once] :: [a]) - (w2 [Occ=Once] :: [a]) -> - case w of { GHC.Types.I# ww1 [Occ=Once] -> + (w [Occ=Once1!] :: Int) + (w1 [Occ=Once1] :: [a]) + (w2 [Occ=Once1] :: [a]) -> + case w of { GHC.Types.I# ww1 [Occ=Once1] -> T18328.$wf @a ww1 w1 w2 }}] f = \ (@a) (w :: Int) (w1 :: [a]) (w2 :: [a]) -> @@ -58,7 +57,7 @@ T18328.$trModule4 = "main"# T18328.$trModule3 :: GHC.Types.TrName [GblId, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, - WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}] + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] T18328.$trModule3 = GHC.Types.TrNameS T18328.$trModule4 -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} @@ -72,14 +71,14 @@ T18328.$trModule2 = "T18328"# T18328.$trModule1 :: GHC.Types.TrName [GblId, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, - WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}] + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] T18328.$trModule1 = GHC.Types.TrNameS T18328.$trModule2 -- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} T18328.$trModule :: GHC.Types.Module [GblId, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, - WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}] + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] T18328.$trModule = GHC.Types.Module T18328.$trModule3 T18328.$trModule1 diff --git a/testsuite/tests/simplCore/should_compile/T3717.stderr b/testsuite/tests/simplCore/should_compile/T3717.stderr index 7ed4f14e60..f428cfc1fa 100644 --- a/testsuite/tests/simplCore/should_compile/T3717.stderr +++ b/testsuite/tests/simplCore/should_compile/T3717.stderr @@ -43,7 +43,7 @@ Rec { -- RHS size: {terms: 10, types: 2, coercions: 0, joins: 0/0} T3717.$wfoo [InlPrag=[2], Occ=LoopBreaker] :: GHC.Prim.Int# -> GHC.Prim.Int# -[GblId, Arity=1, Str=, Unf=OtherCon []] +[GblId, Arity=1, Str=, Unf=OtherCon []] T3717.$wfoo = \ (ww :: GHC.Prim.Int#) -> case ww of ds { @@ -56,7 +56,7 @@ end Rec } foo [InlPrag=[2]] :: Int -> Int [GblId, Arity=1, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, diff --git a/testsuite/tests/simplCore/should_compile/T3772.stdout b/testsuite/tests/simplCore/should_compile/T3772.stdout index b4c072db75..34947f5392 100644 --- a/testsuite/tests/simplCore/should_compile/T3772.stdout +++ b/testsuite/tests/simplCore/should_compile/T3772.stdout @@ -42,7 +42,7 @@ T3772.$trModule Rec { -- RHS size: {terms: 10, types: 2, coercions: 0, joins: 0/0} $wxs :: GHC.Prim.Int# -> () -[GblId, Arity=1, Str=, Unf=OtherCon []] +[GblId, Arity=1, Str=, Unf=OtherCon []] $wxs = \ (ww :: GHC.Prim.Int#) -> case ww of ds1 { @@ -53,7 +53,7 @@ end Rec } -- RHS size: {terms: 10, types: 2, coercions: 0, joins: 0/0} T3772.$wfoo [InlPrag=NOINLINE] :: GHC.Prim.Int# -> () -[GblId, Arity=1, Str=, Unf=OtherCon []] +[GblId, Arity=1, Str=, Unf=OtherCon []] T3772.$wfoo = \ (ww :: GHC.Prim.Int#) -> case GHC.Prim.<# 0# ww of { @@ -65,7 +65,7 @@ T3772.$wfoo foo [InlPrag=[final]] :: Int -> () [GblId, Arity=1, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) diff --git a/testsuite/tests/simplCore/should_compile/T4201.stdout b/testsuite/tests/simplCore/should_compile/T4201.stdout index d6c3879899..c8b6acb12a 100644 --- a/testsuite/tests/simplCore/should_compile/T4201.stdout +++ b/testsuite/tests/simplCore/should_compile/T4201.stdout @@ -1,4 +1,4 @@ [HasNoCafRefs, LambdaFormInfo: LFReEntrant 1, Arity: 1, - Strictness: , + Strictness: , Unfolding: InlineRule (0, True, True) bof `cast` (Sym (N:Foo[0]) %<'Many>_N ->_R _R)] diff --git a/testsuite/tests/simplCore/should_compile/T4908.stderr b/testsuite/tests/simplCore/should_compile/T4908.stderr index 84cfde275b..5db6bc8506 100644 --- a/testsuite/tests/simplCore/should_compile/T4908.stderr +++ b/testsuite/tests/simplCore/should_compile/T4908.stderr @@ -42,7 +42,7 @@ T4908.$trModule Rec { -- RHS size: {terms: 19, types: 5, coercions: 0, joins: 0/0} T4908.f_$s$wf [Occ=LoopBreaker] :: Int -> Int# -> Int# -> Bool -[GblId, Arity=3, Str=, Unf=OtherCon []] +[GblId, Arity=3, Str=<1U>, Unf=OtherCon []] T4908.f_$s$wf = \ (sc :: Int) (sc1 :: Int#) (sc2 :: Int#) -> case sc2 of ds { @@ -59,7 +59,7 @@ end Rec } T4908.$wf [InlPrag=[2]] :: Int# -> (Int, Int) -> Bool [GblId, Arity=2, - Str=, + Str=<1P(A,1P(1U))>, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [30 20] 101 20}] T4908.$wf @@ -81,7 +81,7 @@ T4908.$wf f [InlPrag=[2]] :: Int -> (Int, Int) -> Bool [GblId, Arity=2, - Str=, + Str=<1P(A,1P(1U))>, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=False) diff --git a/testsuite/tests/simplCore/should_compile/T4930.stderr b/testsuite/tests/simplCore/should_compile/T4930.stderr index adf3bf37aa..d0319763fa 100644 --- a/testsuite/tests/simplCore/should_compile/T4930.stderr +++ b/testsuite/tests/simplCore/should_compile/T4930.stderr @@ -43,7 +43,7 @@ Rec { -- RHS size: {terms: 17, types: 3, coercions: 0, joins: 0/0} T4930.$wfoo [InlPrag=[2], Occ=LoopBreaker] :: GHC.Prim.Int# -> GHC.Prim.Int# -[GblId, Arity=1, Str=, Unf=OtherCon []] +[GblId, Arity=1, Str=, Unf=OtherCon []] T4930.$wfoo = \ (ww :: GHC.Prim.Int#) -> case GHC.Prim.<# ww 5# of { @@ -56,7 +56,7 @@ end Rec } foo [InlPrag=[2]] :: Int -> Int [GblId, Arity=1, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, diff --git a/testsuite/tests/simplCore/should_compile/T7360.stderr b/testsuite/tests/simplCore/should_compile/T7360.stderr index 6295890f08..73bafb04f6 100644 --- a/testsuite/tests/simplCore/should_compile/T7360.stderr +++ b/testsuite/tests/simplCore/should_compile/T7360.stderr @@ -8,7 +8,7 @@ T7360.$WFoo3 [InlPrag=INLINE[final] CONLIKE] :: Int %1 -> Foo [GblId[DataConWrapper], Arity=1, Caf=NoCafRefs, - Str=, + Str=, Cpr=m3, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, @@ -21,7 +21,7 @@ T7360.$WFoo3 -- RHS size: {terms: 5, types: 2, coercions: 0, joins: 0/0} fun1 [InlPrag=NOINLINE] :: Foo -> () -[GblId, Arity=1, Str=, Unf=OtherCon []] +[GblId, Arity=1, Str=, Unf=OtherCon []] fun1 = \ (x :: Foo) -> case x of { __DEFAULT -> GHC.Tuple.() } -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} @@ -35,7 +35,7 @@ T7360.fun4 = fun1 T7360.Foo1 fun2 :: forall {a}. [a] -> ((), Int) [GblId, Arity=1, - Str=, + Str=<1U>, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, diff --git a/testsuite/tests/simplCore/should_compile/noinline01.stderr b/testsuite/tests/simplCore/should_compile/noinline01.stderr index d38b5dee03..f8b9a70ee3 100644 --- a/testsuite/tests/simplCore/should_compile/noinline01.stderr +++ b/testsuite/tests/simplCore/should_compile/noinline01.stderr @@ -2,7 +2,7 @@ ==================== Initial STG: ==================== Noinline01.f [InlPrag=INLINE (sat-args=1)] :: forall {p}. p -> GHC.Types.Bool -[GblId, Arity=1, Str=, Unf=OtherCon []] = +[GblId, Arity=1, Str=, Unf=OtherCon []] = \r [eta] GHC.Types.True []; Noinline01.g :: GHC.Types.Bool diff --git a/testsuite/tests/simplCore/should_compile/par01.stderr b/testsuite/tests/simplCore/should_compile/par01.stderr index 5b1cd6423d..91213ee1dc 100644 --- a/testsuite/tests/simplCore/should_compile/par01.stderr +++ b/testsuite/tests/simplCore/should_compile/par01.stderr @@ -6,7 +6,7 @@ Result size of CorePrep Rec { -- RHS size: {terms: 7, types: 3, coercions: 0, joins: 0/0} Par01.depth [Occ=LoopBreaker] :: GHC.Types.Int -> GHC.Types.Int -[GblId, Arity=1, Str=, Unf=OtherCon []] +[GblId, Arity=1, Str=, Unf=OtherCon []] Par01.depth = \ (d :: GHC.Types.Int) -> case GHC.Prim.par# @GHC.Types.Int d of { __DEFAULT -> diff --git a/testsuite/tests/simplCore/should_compile/spec-inline.stderr b/testsuite/tests/simplCore/should_compile/spec-inline.stderr index 36639b35e1..87e8bd7980 100644 --- a/testsuite/tests/simplCore/should_compile/spec-inline.stderr +++ b/testsuite/tests/simplCore/should_compile/spec-inline.stderr @@ -54,7 +54,7 @@ Rec { -- RHS size: {terms: 40, types: 5, coercions: 0, joins: 0/0} Roman.foo_$s$wgo [Occ=LoopBreaker] :: GHC.Prim.Int# -> GHC.Prim.Int# -> GHC.Prim.Int# -[GblId, Arity=2, Str=, Unf=OtherCon []] +[GblId, Arity=2, Str=, Unf=OtherCon []] Roman.foo_$s$wgo = \ (sc :: GHC.Prim.Int#) (sc1 :: GHC.Prim.Int#) -> case GHC.Prim.<=# sc1 0# of { @@ -76,7 +76,7 @@ end Rec } Roman.$wgo [InlPrag=[2]] :: Maybe Int -> Maybe Int -> GHC.Prim.Int# [GblId, Arity=2, - Str=, + Str=, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [61 30] 249 0}] Roman.$wgo @@ -111,7 +111,7 @@ Roman.$wgo Roman.foo_go [InlPrag=[2]] :: Maybe Int -> Maybe Int -> Int [GblId, Arity=2, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, @@ -143,7 +143,7 @@ Roman.foo1 = GHC.Maybe.Just @Int Roman.foo2 foo :: Int -> Int [GblId, Arity=1, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, diff --git a/testsuite/tests/stranal/should_compile/T10694.stderr b/testsuite/tests/stranal/should_compile/T10694.stderr index df5bd122d0..45060226c1 100644 --- a/testsuite/tests/stranal/should_compile/T10694.stderr +++ b/testsuite/tests/stranal/should_compile/T10694.stderr @@ -4,7 +4,7 @@ Result size of Tidy Core = {terms: 74, types: 65, coercions: 0, joins: 0/4} -- RHS size: {terms: 39, types: 25, coercions: 0, joins: 0/4} T10694.$wpm [InlPrag=NOINLINE] :: Int -> Int -> (# Int, Int #) -[GblId, Arity=2, Str=, Unf=OtherCon []] +[GblId, Arity=2, Str=, Unf=OtherCon []] T10694.$wpm = \ (w :: Int) (w1 :: Int) -> let { @@ -26,25 +26,25 @@ T10694.$wpm (# GHC.List.$w!! @Int l3 0#, GHC.List.$w!! @Int l3 1# #) -- RHS size: {terms: 10, types: 11, coercions: 0, joins: 0/0} -pm [InlPrag=NOUSERINLINE[0]] :: Int -> Int -> (Int, Int) +pm [InlPrag=[final]] :: Int -> Int -> (Int, Int) [GblId, Arity=2, - Str=, + Str=, Cpr=m1, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=False) - Tmpl= \ (w [Occ=Once] :: Int) (w1 [Occ=Once] :: Int) -> - case T10694.$wpm w w1 of { (# ww1 [Occ=Once], ww2 [Occ=Once] #) -> (ww1, ww2) }}] + Tmpl= \ (w [Occ=Once1] :: Int) (w1 [Occ=Once1] :: Int) -> + case T10694.$wpm w w1 of { (# ww1 [Occ=Once1], ww2 [Occ=Once1] #) -> (ww1, ww2) }}] pm = \ (w :: Int) (w1 :: Int) -> case T10694.$wpm w w1 of { (# ww1, ww2 #) -> (ww1, ww2) } -- RHS size: {terms: 8, types: 9, coercions: 0, joins: 0/0} m :: Int -> Int -> Int [GblId, Arity=2, - Str=, + Str=, Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=False) - Tmpl= \ (x [Occ=Once] :: Int) (y [Occ=Once] :: Int) -> case pm x y of { (_ [Occ=Dead], mr [Occ=Once]) -> mr }}] + Tmpl= \ (x [Occ=Once1] :: Int) (y [Occ=Once1] :: Int) -> case pm x y of { (_ [Occ=Dead], mr [Occ=Once1]) -> mr }}] m = \ (x :: Int) (y :: Int) -> case T10694.$wpm x y of { (# ww1, ww2 #) -> ww2 } -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} @@ -54,7 +54,7 @@ T10694.$trModule4 = "main"# -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} T10694.$trModule3 :: GHC.Types.TrName -[GblId, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}] +[GblId, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] T10694.$trModule3 = GHC.Types.TrNameS T10694.$trModule4 -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} @@ -64,12 +64,12 @@ T10694.$trModule2 = "T10694"# -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} T10694.$trModule1 :: GHC.Types.TrName -[GblId, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 20}] +[GblId, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] T10694.$trModule1 = GHC.Types.TrNameS T10694.$trModule2 -- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} T10694.$trModule :: GHC.Types.Module -[GblId, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 30}] +[GblId, Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] T10694.$trModule = GHC.Types.Module T10694.$trModule3 T10694.$trModule1 diff --git a/testsuite/tests/stranal/should_compile/T13031.stdout b/testsuite/tests/stranal/should_compile/T13031.stdout index c42eecb616..0b40ec8eeb 100644 --- a/testsuite/tests/stranal/should_compile/T13031.stdout +++ b/testsuite/tests/stranal/should_compile/T13031.stdout @@ -1,2 +1,2 @@ hello -[GblId, Arity=3, Str=b, Cpr=b, Unf=OtherCon []] +[GblId, Arity=3, Str=b, Cpr=b, Unf=OtherCon []] diff --git a/testsuite/tests/stranal/should_compile/T18903.hs b/testsuite/tests/stranal/should_compile/T18903.hs new file mode 100644 index 0000000000..e88a0eea8b --- /dev/null +++ b/testsuite/tests/stranal/should_compile/T18903.hs @@ -0,0 +1,16 @@ +{-# OPTIONS_GHC -O2 -fforce-recomp #-} + +-- | The point of this test is that @g@ get's a demand that says "whenever @g@ +-- is called, the second component of the pair is evaluated strictly". +module T18903 where + +h :: Int -> Int +h m = + let g :: Int -> (Int,Int) + g 1 = (m, 0) + g n = (2 * n, 2 `div` n) + {-# NOINLINE g #-} + in case m of + 1 -> 0 + 2 -> snd (g m) + _ -> uncurry (+) (g m) diff --git a/testsuite/tests/stranal/should_compile/T18903.stderr b/testsuite/tests/stranal/should_compile/T18903.stderr new file mode 100644 index 0000000000..4adbdd566c --- /dev/null +++ b/testsuite/tests/stranal/should_compile/T18903.stderr @@ -0,0 +1,109 @@ + +==================== Tidy Core ==================== +Result size of Tidy Core + = {terms: 84, types: 55, coercions: 0, joins: 0/1} + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T18903.$trModule4 :: GHC.Prim.Addr# +[GblId, + Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}] +T18903.$trModule4 = "main"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T18903.$trModule3 :: GHC.Types.TrName +[GblId, + Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] +T18903.$trModule3 = GHC.Types.TrNameS T18903.$trModule4 + +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +T18903.$trModule2 :: GHC.Prim.Addr# +[GblId, + Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 30 0}] +T18903.$trModule2 = "T18903"# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T18903.$trModule1 :: GHC.Types.TrName +[GblId, + Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] +T18903.$trModule1 = GHC.Types.TrNameS T18903.$trModule2 + +-- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} +T18903.$trModule :: GHC.Types.Module +[GblId, + Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] +T18903.$trModule + = GHC.Types.Module T18903.$trModule3 T18903.$trModule1 + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T18903.h1 :: Int +[GblId, + Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] +T18903.h1 = GHC.Types.I# 0# + +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} +T18903.h2 :: Int +[GblId, + Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] +T18903.h2 = GHC.Types.I# -2# + +-- RHS size: {terms: 56, types: 41, coercions: 0, joins: 0/1} +T18903.$wh [InlPrag=[2]] :: GHC.Prim.Int# -> Int +[GblId, + Arity=1, + Str=, + Unf=Unf{Src=, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, Guidance=IF_ARGS [70] 262 10}] +T18903.$wh + = \ (ww :: GHC.Prim.Int#) -> + let { + $wg [InlPrag=NOINLINE, Dmd=1C1(P(1P(U),SP(U)))] + :: GHC.Prim.Int# -> (# Int, Int #) + [LclId, Arity=1, Str=, Unf=OtherCon []] + $wg + = \ (ww1 [OS=OneShot] :: GHC.Prim.Int#) -> + case ww1 of ds { + __DEFAULT -> + (# GHC.Types.I# (GHC.Prim.*# 2# ds), + case ds of { + __DEFAULT -> + case GHC.Classes.divInt# 2# ds of ww4 { __DEFAULT -> + GHC.Types.I# ww4 + }; + -1# -> T18903.h2; + 0# -> case GHC.Real.divZeroError of wild1 { } + } #); + 1# -> (# GHC.Types.I# ww, T18903.h1 #) + } } in + case ww of ds { + __DEFAULT -> + case $wg ds of { (# ww2, ww3 #) -> + case ww2 of { GHC.Types.I# x -> + case ww3 of { GHC.Types.I# y -> GHC.Types.I# (GHC.Prim.+# x y) } + } + }; + 1# -> T18903.h1; + 2# -> case $wg 2# of { (# ww2, ww3 #) -> ww3 } + } + +-- RHS size: {terms: 6, types: 3, coercions: 0, joins: 0/0} +h [InlPrag=[2]] :: Int -> Int +[GblId, + Arity=1, + Str=, + Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True, + WorkFree=True, Expandable=True, + Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=False) + Tmpl= \ (w [Occ=Once1!] :: Int) -> + case w of { GHC.Types.I# ww1 [Occ=Once1] -> T18903.$wh ww1 }}] +h = \ (w :: Int) -> + case w of { GHC.Types.I# ww1 -> T18903.$wh ww1 } + + + diff --git a/testsuite/tests/stranal/should_compile/all.T b/testsuite/tests/stranal/should_compile/all.T index bb3fcd2952..1262ad426e 100644 --- a/testsuite/tests/stranal/should_compile/all.T +++ b/testsuite/tests/stranal/should_compile/all.T @@ -55,3 +55,6 @@ test('T13380b', [ grep_errmsg('bigDeadAction') ], compile, ['-dppr-cols=200 -dd # We just want to find the worker of foo in there: test('T18122', [ grep_errmsg(r'wfoo =') ], compile, ['-ddump-simpl']) + +# We care about the call demand on $wg +test('T18903', [ grep_errmsg(r'Dmd=\S+C\S+') ], compile, ['-ddump-simpl -dsuppress-uniques']) diff --git a/testsuite/tests/stranal/sigs/BottomFromInnerLambda.stderr b/testsuite/tests/stranal/sigs/BottomFromInnerLambda.stderr index c3845dd6de..a2dade38df 100644 --- a/testsuite/tests/stranal/sigs/BottomFromInnerLambda.stderr +++ b/testsuite/tests/stranal/sigs/BottomFromInnerLambda.stderr @@ -1,8 +1,8 @@ ==================== Strictness signatures ==================== BottomFromInnerLambda.$trModule: -BottomFromInnerLambda.expensive: -BottomFromInnerLambda.f: +BottomFromInnerLambda.expensive: +BottomFromInnerLambda.f: @@ -15,7 +15,7 @@ BottomFromInnerLambda.f: ==================== Strictness signatures ==================== BottomFromInnerLambda.$trModule: -BottomFromInnerLambda.expensive: -BottomFromInnerLambda.f: +BottomFromInnerLambda.expensive: +BottomFromInnerLambda.f: diff --git a/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr b/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr index 54b0a44763..ca6d3015ff 100644 --- a/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr +++ b/testsuite/tests/stranal/sigs/CaseBinderCPR.stderr @@ -1,7 +1,7 @@ ==================== Strictness signatures ==================== CaseBinderCPR.$trModule: -CaseBinderCPR.f_list_cmp: +CaseBinderCPR.f_list_cmp: @@ -13,6 +13,6 @@ CaseBinderCPR.f_list_cmp: m1 ==================== Strictness signatures ==================== CaseBinderCPR.$trModule: -CaseBinderCPR.f_list_cmp: +CaseBinderCPR.f_list_cmp: diff --git a/testsuite/tests/stranal/sigs/DmdAnalGADTs.stderr b/testsuite/tests/stranal/sigs/DmdAnalGADTs.stderr index 6dd5576da4..41fae8f5ce 100644 --- a/testsuite/tests/stranal/sigs/DmdAnalGADTs.stderr +++ b/testsuite/tests/stranal/sigs/DmdAnalGADTs.stderr @@ -5,11 +5,11 @@ DmdAnalGADTs.$tc'B: DmdAnalGADTs.$tcD: DmdAnalGADTs.$trModule: DmdAnalGADTs.diverges: b -DmdAnalGADTs.f: -DmdAnalGADTs.f': -DmdAnalGADTs.g: +DmdAnalGADTs.f: +DmdAnalGADTs.f': +DmdAnalGADTs.g: DmdAnalGADTs.hasCPR: -DmdAnalGADTs.hasStrSig: +DmdAnalGADTs.hasStrSig: @@ -33,10 +33,10 @@ DmdAnalGADTs.$tc'B: DmdAnalGADTs.$tcD: DmdAnalGADTs.$trModule: DmdAnalGADTs.diverges: b -DmdAnalGADTs.f: -DmdAnalGADTs.f': -DmdAnalGADTs.g: +DmdAnalGADTs.f: +DmdAnalGADTs.f': +DmdAnalGADTs.g: DmdAnalGADTs.hasCPR: -DmdAnalGADTs.hasStrSig: +DmdAnalGADTs.hasStrSig: diff --git a/testsuite/tests/stranal/sigs/HyperStrUse.stderr b/testsuite/tests/stranal/sigs/HyperStrUse.stderr index 1ae91db4d4..dc26e84381 100644 --- a/testsuite/tests/stranal/sigs/HyperStrUse.stderr +++ b/testsuite/tests/stranal/sigs/HyperStrUse.stderr @@ -1,7 +1,7 @@ ==================== Strictness signatures ==================== HyperStrUse.$trModule: -HyperStrUse.f: +HyperStrUse.f: @@ -13,6 +13,6 @@ HyperStrUse.f: m1 ==================== Strictness signatures ==================== HyperStrUse.$trModule: -HyperStrUse.f: +HyperStrUse.f: diff --git a/testsuite/tests/stranal/sigs/NewtypeArity.stderr b/testsuite/tests/stranal/sigs/NewtypeArity.stderr index 55cfe94ac7..ebbbbc0c30 100644 --- a/testsuite/tests/stranal/sigs/NewtypeArity.stderr +++ b/testsuite/tests/stranal/sigs/NewtypeArity.stderr @@ -3,8 +3,8 @@ Test.$tc'MkT: Test.$tcT: Test.$trModule: -Test.t: -Test.t2: +Test.t: +Test.t2: @@ -21,7 +21,7 @@ Test.t2: m1 Test.$tc'MkT: Test.$tcT: Test.$trModule: -Test.t: -Test.t2: +Test.t: +Test.t2: diff --git a/testsuite/tests/stranal/sigs/StrAnalExample.stderr b/testsuite/tests/stranal/sigs/StrAnalExample.stderr index eb2c5716bc..e9ac8bab6a 100644 --- a/testsuite/tests/stranal/sigs/StrAnalExample.stderr +++ b/testsuite/tests/stranal/sigs/StrAnalExample.stderr @@ -1,7 +1,7 @@ ==================== Strictness signatures ==================== StrAnalExample.$trModule: -StrAnalExample.foo: +StrAnalExample.foo: @@ -13,6 +13,6 @@ StrAnalExample.foo: ==================== Strictness signatures ==================== StrAnalExample.$trModule: -StrAnalExample.foo: +StrAnalExample.foo: diff --git a/testsuite/tests/stranal/sigs/T12370.stderr b/testsuite/tests/stranal/sigs/T12370.stderr index caa780b0d2..44a90106cf 100644 --- a/testsuite/tests/stranal/sigs/T12370.stderr +++ b/testsuite/tests/stranal/sigs/T12370.stderr @@ -1,8 +1,8 @@ ==================== Strictness signatures ==================== T12370.$trModule: -T12370.bar: -T12370.foo: +T12370.bar: +T12370.foo: @@ -15,7 +15,7 @@ T12370.foo: m1 ==================== Strictness signatures ==================== T12370.$trModule: -T12370.bar: -T12370.foo: +T12370.bar: +T12370.foo: diff --git a/testsuite/tests/stranal/sigs/T13380f.stderr b/testsuite/tests/stranal/sigs/T13380f.stderr index dd53a9c971..a856a1794b 100644 --- a/testsuite/tests/stranal/sigs/T13380f.stderr +++ b/testsuite/tests/stranal/sigs/T13380f.stderr @@ -1,12 +1,12 @@ ==================== Strictness signatures ==================== T13380f.$trModule: -T13380f.f: -T13380f.g: -T13380f.h: -T13380f.interruptibleCall: -T13380f.safeCall: -T13380f.unsafeCall: +T13380f.f: +T13380f.g: <1P(U)> +T13380f.h: <1P(U)> +T13380f.interruptibleCall: +T13380f.safeCall: +T13380f.unsafeCall: @@ -23,11 +23,11 @@ T13380f.unsafeCall: ==================== Strictness signatures ==================== T13380f.$trModule: -T13380f.f: -T13380f.g: -T13380f.h: -T13380f.interruptibleCall: -T13380f.safeCall: -T13380f.unsafeCall: +T13380f.f: +T13380f.g: <1P(U)> +T13380f.h: <1P(U)> +T13380f.interruptibleCall: +T13380f.safeCall: +T13380f.unsafeCall: diff --git a/testsuite/tests/stranal/sigs/T17932.stderr b/testsuite/tests/stranal/sigs/T17932.stderr index 7ca56637df..072af8d45e 100644 --- a/testsuite/tests/stranal/sigs/T17932.stderr +++ b/testsuite/tests/stranal/sigs/T17932.stderr @@ -5,7 +5,7 @@ T17932.$tc'X: T17932.$tcOptions: T17932.$tcX: T17932.$trModule: -T17932.flags: +T17932.flags: @@ -25,6 +25,6 @@ T17932.$tc'X: T17932.$tcOptions: T17932.$tcX: T17932.$trModule: -T17932.flags: +T17932.flags: diff --git a/testsuite/tests/stranal/sigs/T18086.stderr b/testsuite/tests/stranal/sigs/T18086.stderr index 6941e233f8..0ac4c846ee 100644 --- a/testsuite/tests/stranal/sigs/T18086.stderr +++ b/testsuite/tests/stranal/sigs/T18086.stderr @@ -1,8 +1,8 @@ ==================== Strictness signatures ==================== T18086.$trModule: -T18086.m: x -T18086.panic: x +T18086.m: x +T18086.panic: x @@ -15,7 +15,7 @@ T18086.panic: ==================== Strictness signatures ==================== T18086.$trModule: -T18086.m: x -T18086.panic: x +T18086.m: x +T18086.panic: x diff --git a/testsuite/tests/stranal/sigs/T18957.hs b/testsuite/tests/stranal/sigs/T18957.hs new file mode 100644 index 0000000000..9781b7cd58 --- /dev/null +++ b/testsuite/tests/stranal/sigs/T18957.hs @@ -0,0 +1,31 @@ +{-# OPTIONS_GHC -O2 -fforce-recomp #-} +{-# LANGUAGE BangPatterns #-} + +-- | This ticket is about demand `seq` puts its first argument under and +-- how that affects call demands. +module T18957 where + +-- | Should put its first argument under head demand +seq' :: a -> b -> b +seq' a b = seq a b +{-# NOINLINE seq' #-} + +-- | The first argument is evaluated at once, but called every time it's +-- evaluated +g :: (Int -> Int) -> Int -> Int +g f x = if x < 100 then f x else 200 + +-- | The first argument is evaluated multiple times, but called at most once +-- every time it's evaluated +h1 :: (Int -> Int) -> Int -> Int +-- Note that seq' is like seq, but NOINLINE. See h2 below why +h1 f x = f `seq'` if x < 100 then f x else 200 + +-- | Like h1, but using `seq` directly, which will rewrite the call site +-- of @f@ to use the case binder instead, which means we won't evaluate it an +-- additional time. So evaluated once and called once. +h2 :: (Int -> Int) -> Int -> Int +h2 f x = f `seq` if x < 100 then f x else 200 + +h3 :: (Int -> Int) -> Int -> Int +h3 f x = if x < 100 then f x + f (x+1) else 200 diff --git a/testsuite/tests/stranal/sigs/T18957.stderr b/testsuite/tests/stranal/sigs/T18957.stderr new file mode 100644 index 0000000000..c536410e0a --- /dev/null +++ b/testsuite/tests/stranal/sigs/T18957.stderr @@ -0,0 +1,30 @@ + +==================== Strictness signatures ==================== +T18957.$trModule: +T18957.g: <1C1(U)> +T18957.h1: +T18957.h2: +T18957.h3: +T18957.seq': + + + +==================== Cpr signatures ==================== +T18957.$trModule: +T18957.g: +T18957.h1: +T18957.h2: +T18957.h3: m1 +T18957.seq': + + + +==================== Strictness signatures ==================== +T18957.$trModule: +T18957.g: <1C1(U)> +T18957.h1: +T18957.h2: +T18957.h3: +T18957.seq': + + diff --git a/testsuite/tests/stranal/sigs/T5075.stderr b/testsuite/tests/stranal/sigs/T5075.stderr index e048ce2fb3..64a78d05ec 100644 --- a/testsuite/tests/stranal/sigs/T5075.stderr +++ b/testsuite/tests/stranal/sigs/T5075.stderr @@ -1,7 +1,7 @@ ==================== Strictness signatures ==================== T5075.$trModule: -T5075.loop: +T5075.loop: @@ -13,6 +13,6 @@ T5075.loop: ==================== Strictness signatures ==================== T5075.$trModule: -T5075.loop: +T5075.loop: diff --git a/testsuite/tests/stranal/sigs/T8569.stderr b/testsuite/tests/stranal/sigs/T8569.stderr index bfbd22e52e..cc7a5e9fb0 100644 --- a/testsuite/tests/stranal/sigs/T8569.stderr +++ b/testsuite/tests/stranal/sigs/T8569.stderr @@ -4,7 +4,7 @@ T8569.$tc'Rdata: T8569.$tc'Rint: T8569.$tcRep: T8569.$trModule: -T8569.addUp: +T8569.addUp: @@ -22,6 +22,6 @@ T8569.$tc'Rdata: T8569.$tc'Rint: T8569.$tcRep: T8569.$trModule: -T8569.addUp: +T8569.addUp: diff --git a/testsuite/tests/stranal/sigs/T8598.stderr b/testsuite/tests/stranal/sigs/T8598.stderr index 8c56089bcd..7e68094018 100644 --- a/testsuite/tests/stranal/sigs/T8598.stderr +++ b/testsuite/tests/stranal/sigs/T8598.stderr @@ -1,7 +1,7 @@ ==================== Strictness signatures ==================== T8598.$trModule: -T8598.fun: +T8598.fun: @@ -13,6 +13,6 @@ T8598.fun: m1 ==================== Strictness signatures ==================== T8598.$trModule: -T8598.fun: +T8598.fun: diff --git a/testsuite/tests/stranal/sigs/UnsatFun.hs b/testsuite/tests/stranal/sigs/UnsatFun.hs index c38c5cba1d..e9587245d1 100644 --- a/testsuite/tests/stranal/sigs/UnsatFun.hs +++ b/testsuite/tests/stranal/sigs/UnsatFun.hs @@ -35,6 +35,7 @@ h3 f = f 2 `seq` 3 -- And here we check that the depth of the strictness --- of h is applied correctly. +-- of h is applied correctly. The lambda is unsaturated +-- and thus x is absent. g3 :: Int -> Int g3 x = h3 (\_ _ -> error (show x)) diff --git a/testsuite/tests/stranal/sigs/UnsatFun.stderr b/testsuite/tests/stranal/sigs/UnsatFun.stderr index 325d25ced7..18723bad40 100644 --- a/testsuite/tests/stranal/sigs/UnsatFun.stderr +++ b/testsuite/tests/stranal/sigs/UnsatFun.stderr @@ -1,13 +1,13 @@ ==================== Strictness signatures ==================== UnsatFun.$trModule: -UnsatFun.f: b -UnsatFun.g: b -UnsatFun.g': -UnsatFun.g3: -UnsatFun.h: -UnsatFun.h2: -UnsatFun.h3: +UnsatFun.f: b +UnsatFun.g: b +UnsatFun.g': <1P(U)> +UnsatFun.g3: +UnsatFun.h: +UnsatFun.h2: <1C1(U)> +UnsatFun.h3: @@ -25,12 +25,12 @@ UnsatFun.h3: m1 ==================== Strictness signatures ==================== UnsatFun.$trModule: -UnsatFun.f: b -UnsatFun.g: b -UnsatFun.g': -UnsatFun.g3: -UnsatFun.h: -UnsatFun.h2: -UnsatFun.h3: +UnsatFun.f: b +UnsatFun.g: b +UnsatFun.g': <1P(U)> +UnsatFun.g3: +UnsatFun.h: +UnsatFun.h2: <1C1(U)> +UnsatFun.h3: diff --git a/testsuite/tests/stranal/sigs/all.T b/testsuite/tests/stranal/sigs/all.T index 387a1a7f7d..07cc815823 100644 --- a/testsuite/tests/stranal/sigs/all.T +++ b/testsuite/tests/stranal/sigs/all.T @@ -23,3 +23,4 @@ test('T17932', normal, compile, ['']) test('T13380c', expect_broken('!3014'), compile, ['']) test('T13380f', normal, compile, ['']) test('T18086', normal, compile, ['-package ghc']) +test('T18957', normal, compile, ['']) -- cgit v1.2.1