Simon Peyton Jones pushed to branch wip/T26831 at Glasgow Haskell Compiler / GHC
Commits:
-
c60d2eb6
by Simon Peyton Jones at 2026-04-01T15:06:31+01:00
7 changed files:
- compiler/GHC/Core/Unfold.hs
- testsuite/tests/arityanal/should_compile/Arity01.stderr
- testsuite/tests/arityanal/should_compile/Arity05.stderr
- testsuite/tests/arityanal/should_compile/Arity08.stderr
- testsuite/tests/arityanal/should_compile/Arity11.stderr
- testsuite/tests/arityanal/should_compile/Arity14.stderr
- testsuite/tests/simplCore/should_compile/T15205.stderr
Changes:
| ... | ... | @@ -779,22 +779,28 @@ litSize _other = 0 -- Must match size of nullary constructors |
| 779 | 779 | |
| 780 | 780 | classOpSize :: UnfoldingOpts -> Class -> [Id] -> [CoreExpr] -> ExprSize
|
| 781 | 781 | -- See (IA1) in Note [Interesting arguments] in GHC.Core.Opt.Simplify.Utils
|
| 782 | -classOpSize opts cls top_args args
|
|
| 783 | - | isUnaryClass cls
|
|
| 784 | - = sizeZero -- See (UCM4) in Note [Unary class magic] in GHC.Core.TyCon
|
|
| 785 | - | otherwise
|
|
| 786 | - = case args of
|
|
| 787 | - [] -> sizeZero
|
|
| 788 | - (arg1:other_args) -> SizeIs (size other_args) (arg_discount arg1) 0
|
|
| 782 | +classOpSize _opts _cls _top_args []
|
|
| 783 | + = sizeZero -- A non-applied classop
|
|
| 784 | +classOpSize opts cls top_args (dict_arg:other_val_args)
|
|
| 785 | + = SizeIs size (arg_discount dict_arg) 0
|
|
| 789 | 786 | where
|
| 790 | - size other_args = 20 + (10 * length other_args)
|
|
| 787 | + size | isUnaryClass cls = 0 -- See (UCM4) in Note [Unary class magic] in GHC.Core.TyCon
|
|
| 788 | + | otherwise = 20 + (10 * length other_val_args)
|
|
| 791 | 789 | |
| 792 | 790 | -- If the class op is scrutinising a lambda bound dictionary then
|
| 793 | 791 | -- give it a discount, to encourage the inlining of this function
|
| 794 | - -- The actual discount is rather arbitrarily chosen
|
|
| 795 | - arg_discount (Var dict) | dict `elem` top_args
|
|
| 796 | - = unitBag (dict, unfoldingDictDiscount opts)
|
|
| 797 | - arg_discount _ = emptyBag
|
|
| 792 | + arg_discount (Cast arg _co) = arg_discount arg
|
|
| 793 | + arg_discount (Var dict) | dict `elem` top_args = unitBag (dict, dict_discount)
|
|
| 794 | + arg_discount _ = emptyBag
|
|
| 795 | + |
|
| 796 | + -- If we have (class-op d arg1 .. argn) then it's super-good to inline
|
|
| 797 | + -- to expose `d`; not only can we do the dictionary selection
|
|
| 798 | + -- (class-op d), but that will likely expose a lambda which we can then
|
|
| 799 | + -- apply. In that case (n > 0), we add `unfoldingFunAppDiscount`.
|
|
| 800 | + -- See the discussion on #26831, esp "Delicate inlining".
|
|
| 801 | + dict_discount
|
|
| 802 | + | null other_val_args = unfoldingDictDiscount opts
|
|
| 803 | + | otherwise = unfoldingDictDiscount opts + unfoldingFunAppDiscount opts
|
|
| 798 | 804 | |
| 799 | 805 | -- | The size of a function call
|
| 800 | 806 | callSize
|
| ... | ... | @@ -5,19 +5,19 @@ Result size of Tidy Core = {terms: 71, types: 43, coercions: 0, joins: 0/0} |
| 5 | 5 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 6 | 6 | F1.f2 :: Integer
|
| 7 | 7 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 8 | -F1.f2 = GHC.Num.Integer.IS 1#
|
|
| 8 | +F1.f2 = GHC.Internal.Bignum.Integer.IS 1#
|
|
| 9 | 9 | |
| 10 | 10 | Rec {
|
| 11 | 11 | -- RHS size: {terms: 24, types: 6, coercions: 0, joins: 0/0}
|
| 12 | 12 | F1.f1_h1 [Occ=LoopBreaker] :: Integer -> Integer -> Integer -> Integer
|
| 13 | 13 | [GblId, Arity=3, Str=<1L><1L><SL>, Unf=OtherCon []]
|
| 14 | 14 | F1.f1_h1
|
| 15 | - = \ (n :: Integer) (x :: Integer) (eta [OS=OneShot] :: Integer) ->
|
|
| 15 | + = \ (n :: Integer) (x [OS=OneShot] :: Integer) (eta [OS=OneShot] :: Integer) ->
|
|
| 16 | 16 | case x of x1 { __DEFAULT ->
|
| 17 | 17 | case n of y1 { __DEFAULT ->
|
| 18 | - case GHC.Num.Integer.integerLt# x1 y1 of {
|
|
| 18 | + case GHC.Internal.Bignum.Integer.integerLt# x1 y1 of {
|
|
| 19 | 19 | __DEFAULT -> eta;
|
| 20 | - 1# -> F1.f1_h1 y1 (GHC.Num.Integer.integerAdd x1 F1.f2) (GHC.Num.Integer.integerAdd x1 eta)
|
|
| 20 | + 1# -> F1.f1_h1 y1 (GHC.Internal.Bignum.Integer.integerAdd x1 F1.f2) (GHC.Internal.Bignum.Integer.integerAdd x1 eta)
|
|
| 21 | 21 | }
|
| 22 | 22 | }
|
| 23 | 23 | }
|
| ... | ... | @@ -26,7 +26,7 @@ end Rec } |
| 26 | 26 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 27 | 27 | F1.f3 :: Integer
|
| 28 | 28 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 29 | -F1.f3 = GHC.Num.Integer.IS 5#
|
|
| 29 | +F1.f3 = GHC.Internal.Bignum.Integer.IS 5#
|
|
| 30 | 30 | |
| 31 | 31 | -- RHS size: {terms: 4, types: 0, coercions: 0, joins: 0/0}
|
| 32 | 32 | f1 :: Integer
|
| ... | ... | @@ -36,27 +36,27 @@ f1 = F1.f1_h1 F1.f3 F1.f2 F1.f3 |
| 36 | 36 | -- RHS size: {terms: 14, types: 5, coercions: 0, joins: 0/0}
|
| 37 | 37 | g :: Integer -> Integer -> Integer -> Integer -> Integer -> Integer
|
| 38 | 38 | [GblId, Arity=5, Str=<1L><SL><SL><SL><SL>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [0 0 0 0 0] 120 0}]
|
| 39 | -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
|
|
| 39 | +g = \ (x1 :: Integer) (x2 :: Integer) (x3 :: Integer) (x4 :: Integer) (x5 :: Integer) -> GHC.Internal.Bignum.Integer.integerAdd (GHC.Internal.Bignum.Integer.integerAdd (GHC.Internal.Bignum.Integer.integerAdd (GHC.Internal.Bignum.Integer.integerAdd x1 x2) x3) x4) x5
|
|
| 40 | 40 | |
| 41 | 41 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 42 | 42 | F1.s1 :: Integer
|
| 43 | 43 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 44 | -F1.s1 = GHC.Num.Integer.IS 3#
|
|
| 44 | +F1.s1 = GHC.Internal.Bignum.Integer.IS 3#
|
|
| 45 | 45 | |
| 46 | 46 | -- RHS size: {terms: 8, types: 7, coercions: 0, joins: 0/0}
|
| 47 | 47 | s :: forall {t1} {t2}. Num t1 => (t1 -> t2) -> t2
|
| 48 | -[GblId, Arity=2, Str=<MP(A,A,A,A,A,A,1C(1,L))><1C(1,L)>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [30 60] 50 0}]
|
|
| 48 | +[GblId, Arity=2, Str=<MP(A,A,A,A,A,A,1C(1,L))><1C(1,L)>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [90 60] 50 0}]
|
|
| 49 | 49 | s = \ (@t) (@t1) ($dNum :: Num t) (f :: t -> t1) -> f (fromInteger @t $dNum F1.s1)
|
| 50 | 50 | |
| 51 | 51 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 52 | 52 | F1.h1 :: Integer
|
| 53 | 53 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 54 | -F1.h1 = GHC.Num.Integer.IS 24#
|
|
| 54 | +F1.h1 = GHC.Internal.Bignum.Integer.IS 24#
|
|
| 55 | 55 | |
| 56 | 56 | -- RHS size: {terms: 4, types: 1, coercions: 0, joins: 0/0}
|
| 57 | 57 | h :: Integer -> Integer
|
| 58 | 58 | [GblId, Arity=1, Str=<SL>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [0] 30 0}]
|
| 59 | -h = \ (x5 :: Integer) -> GHC.Num.Integer.integerAdd F1.h1 x5
|
|
| 59 | +h = \ (x5 :: Integer) -> GHC.Internal.Bignum.Integer.integerAdd F1.h1 x5
|
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 |
| ... | ... | @@ -5,27 +5,27 @@ Result size of Tidy Core = {terms: 42, types: 44, coercions: 0, joins: 0/0} |
| 5 | 5 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 6 | 6 | F5.f5g1 :: Integer
|
| 7 | 7 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 8 | -F5.f5g1 = GHC.Num.Integer.IS 1#
|
|
| 8 | +F5.f5g1 = GHC.Internal.Bignum.Integer.IS 1#
|
|
| 9 | 9 | |
| 10 | 10 | -- RHS size: {terms: 12, types: 9, coercions: 0, joins: 0/0}
|
| 11 | 11 | f5g :: forall {a} {t}. Num a => (t -> a) -> t -> a
|
| 12 | -[GblId, Arity=3, Str=<SP(1C(1,C(1,L)),A,A,A,A,A,MC(1,L))><MC(1,L)><L>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 60 0] 90 0}]
|
|
| 12 | +[GblId, Arity=3, Str=<SP(1C(1,C(1,L)),A,A,A,A,A,MC(1,L))><MC(1,L)><L>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [180 60 0] 90 0}]
|
|
| 13 | 13 | f5g = \ (@a) (@t) ($dNum :: Num a) (h :: t -> a) (z :: t) -> + @a $dNum (h z) (fromInteger @a $dNum F5.f5g1)
|
| 14 | 14 | |
| 15 | 15 | -- RHS size: {terms: 17, types: 12, coercions: 0, joins: 0/0}
|
| 16 | 16 | f5h :: forall {a} {t}. Num a => (t -> a) -> t -> (t -> a) -> a
|
| 17 | -[GblId, Arity=4, Str=<SP(SC(S,C(1,L)),A,A,A,A,A,MC(1,L))><MC(1,L)><L><MC(1,L)>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [90 60 0 60] 150 0}]
|
|
| 17 | +[GblId, Arity=4, Str=<SP(SC(S,C(1,L)),A,A,A,A,A,MC(1,L))><MC(1,L)><L><MC(1,L)>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [270 60 0 60] 150 0}]
|
|
| 18 | 18 | f5h = \ (@a) (@t) ($dNum :: Num a) (f :: t -> a) (x :: t) (g :: t -> a) -> + @a $dNum (f x) (+ @a $dNum (g x) (fromInteger @a $dNum F5.f5g1))
|
| 19 | 19 | |
| 20 | 20 | -- RHS size: {terms: 4, types: 1, coercions: 0, joins: 0/0}
|
| 21 | 21 | f5y :: Integer -> Integer
|
| 22 | 22 | [GblId, Arity=1, Str=<1L>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [0] 30 0}]
|
| 23 | -f5y = \ (y :: Integer) -> GHC.Num.Integer.integerAdd y F5.f5g1
|
|
| 23 | +f5y = \ (y :: Integer) -> GHC.Internal.Bignum.Integer.integerAdd y F5.f5g1
|
|
| 24 | 24 | |
| 25 | 25 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 26 | 26 | f5 :: Integer
|
| 27 | 27 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 28 | -f5 = GHC.Num.Integer.IS 3#
|
|
| 28 | +f5 = GHC.Internal.Bignum.Integer.IS 3#
|
|
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 |
| ... | ... | @@ -4,7 +4,7 @@ Result size of Tidy Core = {terms: 24, types: 18, coercions: 0, joins: 0/0} |
| 4 | 4 | |
| 5 | 5 | -- RHS size: {terms: 20, types: 10, coercions: 0, joins: 0/0}
|
| 6 | 6 | f8f :: forall {p}. Num p => Bool -> p -> p -> p
|
| 7 | -[GblId, Arity=4, Str=<LP(SC(S,C(1,L)),A,MC(1,C(1,L)),A,A,A,A)><1L><L><L>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [90 30 0 0] 140 0}]
|
|
| 7 | +[GblId, Arity=4, Str=<LP(SC(S,C(1,L)),A,MC(1,C(1,L)),A,A,A,A)><1L><L><L>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [270 30 0 0] 140 0}]
|
|
| 8 | 8 | f8f
|
| 9 | 9 | = \ (@p) ($dNum :: Num p) (b :: Bool) (x :: p) (y :: p) ->
|
| 10 | 10 | case b of {
|
| ... | ... | @@ -15,7 +15,7 @@ f8f |
| 15 | 15 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 16 | 16 | f8 :: Integer
|
| 17 | 17 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 18 | -f8 = GHC.Num.Integer.IS 2#
|
|
| 18 | +f8 = GHC.Internal.Bignum.Integer.IS 2#
|
|
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 |
| ... | ... | @@ -5,57 +5,23 @@ Result size of Tidy Core = {terms: 136, types: 75, coercions: 0, joins: 2/7} |
| 5 | 5 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 6 | 6 | F11.fib3 :: Integer
|
| 7 | 7 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 8 | -F11.fib3 = GHC.Num.Integer.IS 1#
|
|
| 8 | +F11.fib3 = GHC.Internal.Bignum.Integer.IS 1#
|
|
| 9 | 9 | |
| 10 | 10 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 11 | 11 | F11.fib2 :: Integer
|
| 12 | 12 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 13 | -F11.fib2 = GHC.Num.Integer.IS 2#
|
|
| 14 | - |
|
| 15 | -Rec {
|
|
| 16 | --- RHS size: {terms: 38, types: 13, coercions: 0, joins: 2/2}
|
|
| 17 | -F11.f11_fib [Occ=LoopBreaker] :: Integer -> Integer
|
|
| 18 | -[GblId, Arity=1, Str=<SL>, Unf=OtherCon []]
|
|
| 19 | -F11.f11_fib
|
|
| 20 | - = \ (ds :: Integer) ->
|
|
| 21 | - join {
|
|
| 22 | - $j [Dmd=ML] :: Integer
|
|
| 23 | - [LclId[JoinId(0)(Nothing)]]
|
|
| 24 | - $j
|
|
| 25 | - = join {
|
|
| 26 | - $j1 [Dmd=ML] :: Integer
|
|
| 27 | - [LclId[JoinId(0)(Nothing)]]
|
|
| 28 | - $j1 = GHC.Num.Integer.integerAdd (F11.f11_fib (GHC.Num.Integer.integerSub ds F11.fib3)) (F11.f11_fib (GHC.Num.Integer.integerSub ds F11.fib2)) } in
|
|
| 29 | - case ds of {
|
|
| 30 | - GHC.Num.Integer.IS x1 ->
|
|
| 31 | - case x1 of {
|
|
| 32 | - __DEFAULT -> jump $j1;
|
|
| 33 | - 1# -> F11.fib3
|
|
| 34 | - };
|
|
| 35 | - GHC.Num.Integer.IP x1 -> jump $j1;
|
|
| 36 | - GHC.Num.Integer.IN x1 -> jump $j1
|
|
| 37 | - } } in
|
|
| 38 | - case ds of {
|
|
| 39 | - GHC.Num.Integer.IS x1 ->
|
|
| 40 | - case x1 of {
|
|
| 41 | - __DEFAULT -> jump $j;
|
|
| 42 | - 0# -> F11.fib3
|
|
| 43 | - };
|
|
| 44 | - GHC.Num.Integer.IP x1 -> jump $j;
|
|
| 45 | - GHC.Num.Integer.IN x1 -> jump $j
|
|
| 46 | - }
|
|
| 47 | -end Rec }
|
|
| 13 | +F11.fib2 = GHC.Internal.Bignum.Integer.IS 2#
|
|
| 48 | 14 | |
| 49 | 15 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 50 | 16 | F11.fib1 :: Integer
|
| 51 | 17 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 52 | -F11.fib1 = GHC.Num.Integer.IS 0#
|
|
| 18 | +F11.fib1 = GHC.Internal.Bignum.Integer.IS 0#
|
|
| 53 | 19 | |
| 54 | 20 | -- RHS size: {terms: 54, types: 27, coercions: 0, joins: 0/5}
|
| 55 | -fib :: forall {t} {a}. (Eq t, Num t, Num a) => t -> a
|
|
| 56 | -[GblId, Arity=4, Str=<SP(SC(S,C(1,L)),A)><LP(A,LC(L,C(1,L)),A,A,A,A,L)><LP(LC(S,C(1,L)),A,A,A,A,A,MC(1,L))><L>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [60 150 60 0] 480 0}]
|
|
| 21 | +fib :: forall {t1} {t2}. (Eq t1, Num t1, Num t2) => t1 -> t2
|
|
| 22 | +[GblId, Arity=4, Str=<SP(SC(S,C(1,L)),A)><LP(A,LC(L,C(1,L)),A,A,A,A,L)><LP(LC(S,C(1,L)),A,A,A,A,A,MC(1,L))><L>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [180 450 180 0] 480 0}]
|
|
| 57 | 23 | fib
|
| 58 | - = \ (@t) (@a) ($dEq :: Eq t) ($dNum :: Num t) ($dNum1 :: Num a) (eta :: t) ->
|
|
| 24 | + = \ (@t) (@t1) ($dEq :: Eq t) ($dNum :: Num t) ($dNum1 :: Num t1) (eta :: t) ->
|
|
| 59 | 25 | let {
|
| 60 | 26 | lvl :: t
|
| 61 | 27 | [LclId]
|
| ... | ... | @@ -65,32 +31,66 @@ fib |
| 65 | 31 | [LclId]
|
| 66 | 32 | lvl1 = fromInteger @t $dNum F11.fib2 } in
|
| 67 | 33 | let {
|
| 68 | - lvl2 :: a
|
|
| 34 | + lvl2 :: t1
|
|
| 69 | 35 | [LclId]
|
| 70 | - lvl2 = fromInteger @a $dNum1 F11.fib3 } in
|
|
| 36 | + lvl2 = fromInteger @t1 $dNum1 F11.fib3 } in
|
|
| 71 | 37 | let {
|
| 72 | 38 | lvl3 :: t
|
| 73 | 39 | [LclId]
|
| 74 | 40 | lvl3 = fromInteger @t $dNum F11.fib1 } in
|
| 75 | 41 | letrec {
|
| 76 | - fib4 [Occ=LoopBreaker, Dmd=SC(S,L)] :: t -> a
|
|
| 42 | + fib4 [Occ=LoopBreaker, Dmd=SC(S,L)] :: t -> t1
|
|
| 77 | 43 | [LclId, Arity=1, Str=<L>, Unf=OtherCon []]
|
| 78 | 44 | fib4
|
| 79 | 45 | = \ (ds :: t) ->
|
| 80 | 46 | case == @t $dEq ds lvl3 of {
|
| 81 | 47 | False ->
|
| 82 | 48 | case == @t $dEq ds lvl of {
|
| 83 | - False -> + @a $dNum1 (fib4 (- @t $dNum ds lvl)) (fib4 (- @t $dNum ds lvl1));
|
|
| 49 | + False -> + @t1 $dNum1 (fib4 (- @t $dNum ds lvl)) (fib4 (- @t $dNum ds lvl1));
|
|
| 84 | 50 | True -> lvl2
|
| 85 | 51 | };
|
| 86 | 52 | True -> lvl2
|
| 87 | 53 | }; } in
|
| 88 | 54 | fib4 eta
|
| 89 | 55 | |
| 56 | +Rec {
|
|
| 57 | +-- RHS size: {terms: 38, types: 13, coercions: 0, joins: 2/2}
|
|
| 58 | +F11.f11_fib [Occ=LoopBreaker] :: Integer -> Integer
|
|
| 59 | +[GblId, Arity=1, Str=<SL>, Unf=OtherCon []]
|
|
| 60 | +F11.f11_fib
|
|
| 61 | + = \ (ds :: Integer) ->
|
|
| 62 | + join {
|
|
| 63 | + $j [Dmd=ML] :: Integer
|
|
| 64 | + [LclId[JoinId(0)(Nothing)]]
|
|
| 65 | + $j
|
|
| 66 | + = join {
|
|
| 67 | + $j1 [Dmd=ML] :: Integer
|
|
| 68 | + [LclId[JoinId(0)(Nothing)]]
|
|
| 69 | + $j1 = GHC.Internal.Bignum.Integer.integerAdd (F11.f11_fib (GHC.Internal.Bignum.Integer.integerSub ds F11.fib3)) (F11.f11_fib (GHC.Internal.Bignum.Integer.integerSub ds F11.fib2)) } in
|
|
| 70 | + case ds of {
|
|
| 71 | + GHC.Internal.Bignum.Integer.IS x ->
|
|
| 72 | + case x of {
|
|
| 73 | + __DEFAULT -> jump $j1;
|
|
| 74 | + 1# -> F11.fib3
|
|
| 75 | + };
|
|
| 76 | + GHC.Internal.Bignum.Integer.IP x -> jump $j1;
|
|
| 77 | + GHC.Internal.Bignum.Integer.IN x -> jump $j1
|
|
| 78 | + } } in
|
|
| 79 | + case ds of {
|
|
| 80 | + GHC.Internal.Bignum.Integer.IS x ->
|
|
| 81 | + case x of {
|
|
| 82 | + __DEFAULT -> jump $j;
|
|
| 83 | + 0# -> F11.fib3
|
|
| 84 | + };
|
|
| 85 | + GHC.Internal.Bignum.Integer.IP x -> jump $j;
|
|
| 86 | + GHC.Internal.Bignum.Integer.IN x -> jump $j
|
|
| 87 | + }
|
|
| 88 | +end Rec }
|
|
| 89 | + |
|
| 90 | 90 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 91 | 91 | F11.f3 :: Integer
|
| 92 | 92 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 93 | -F11.f3 = GHC.Num.Integer.IS 1000#
|
|
| 93 | +F11.f3 = GHC.Internal.Bignum.Integer.IS 1000#
|
|
| 94 | 94 | |
| 95 | 95 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 96 | 96 | F11.f11_x :: Integer
|
| ... | ... | @@ -100,7 +100,7 @@ F11.f11_x = F11.f11_fib F11.f3 |
| 100 | 100 | -- RHS size: {terms: 4, types: 1, coercions: 0, joins: 0/0}
|
| 101 | 101 | F11.f11f1 :: Integer -> Integer
|
| 102 | 102 | [GblId, Arity=1, Str=<SL>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [0] 30 0}]
|
| 103 | -F11.f11f1 = \ (y :: Integer) -> GHC.Num.Integer.integerAdd F11.f11_x y
|
|
| 103 | +F11.f11f1 = \ (y :: Integer) -> GHC.Internal.Bignum.Integer.integerAdd F11.f11_x y
|
|
| 104 | 104 | |
| 105 | 105 | -- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
|
| 106 | 106 | f11f :: forall {p}. p -> Integer -> Integer
|
| ... | ... | @@ -110,22 +110,22 @@ f11f = \ (@p) _ [Occ=Dead] -> F11.f11f1 |
| 110 | 110 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 111 | 111 | F11.f5 :: Integer
|
| 112 | 112 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 113 | -F11.f5 = GHC.Num.Integer.IS 6#
|
|
| 113 | +F11.f5 = GHC.Internal.Bignum.Integer.IS 6#
|
|
| 114 | 114 | |
| 115 | 115 | -- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
|
| 116 | 116 | F11.f4 :: Integer
|
| 117 | 117 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 30 0}]
|
| 118 | -F11.f4 = GHC.Num.Integer.integerAdd F11.f11_x F11.f5
|
|
| 118 | +F11.f4 = GHC.Internal.Bignum.Integer.integerAdd F11.f11_x F11.f5
|
|
| 119 | 119 | |
| 120 | 120 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 121 | 121 | F11.f2 :: Integer
|
| 122 | 122 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 123 | -F11.f2 = GHC.Num.Integer.IS 8#
|
|
| 123 | +F11.f2 = GHC.Internal.Bignum.Integer.IS 8#
|
|
| 124 | 124 | |
| 125 | 125 | -- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
|
| 126 | 126 | F11.f1 :: Integer
|
| 127 | 127 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=IF_ARGS [] 30 0}]
|
| 128 | -F11.f1 = GHC.Num.Integer.integerAdd F11.f11_x F11.f2
|
|
| 128 | +F11.f1 = GHC.Internal.Bignum.Integer.integerAdd F11.f11_x F11.f2
|
|
| 129 | 129 | |
| 130 | 130 | -- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
|
| 131 | 131 | f11 :: (Integer, Integer)
|
| ... | ... | @@ -133,7 +133,4 @@ f11 :: (Integer, Integer) |
| 133 | 133 | f11 = (F11.f4, F11.f1)
|
| 134 | 134 | |
| 135 | 135 | |
| 136 | ------- Local rules for imported ids --------
|
|
| 137 | -"SPEC fib @Integer @Integer" forall ($dEq :: Eq Integer) ($dNum :: Num Integer) ($dNum1 :: Num Integer). fib @Integer @Integer $dEq $dNum $dNum1 = F11.f11_fib
|
|
| 138 | - |
|
| 139 | 136 |
| ... | ... | @@ -3,18 +3,18 @@ |
| 3 | 3 | Result size of Tidy Core = {terms: 44, types: 38, coercions: 0, joins: 0/3}
|
| 4 | 4 | |
| 5 | 5 | -- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
|
| 6 | -F14.f1 :: forall {t}. t -> t
|
|
| 6 | +F14.f1 :: forall t. t -> t
|
|
| 7 | 7 | [GblId, Arity=1, Str=<1L>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)}]
|
| 8 | 8 | F14.f1 = \ (@t) (y :: t) -> y
|
| 9 | 9 | |
| 10 | 10 | -- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
| 11 | 11 | F14.f2 :: Integer
|
| 12 | 12 | [GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}]
|
| 13 | -F14.f2 = GHC.Num.Integer.IS 1#
|
|
| 13 | +F14.f2 = GHC.Internal.Bignum.Integer.IS 1#
|
|
| 14 | 14 | |
| 15 | 15 | -- RHS size: {terms: 36, types: 23, coercions: 0, joins: 0/3}
|
| 16 | 16 | f14 :: forall {t}. (Ord t, Num t) => t -> t -> t -> t
|
| 17 | -[GblId, Arity=4, Str=<SP(A,A,SC(S,C(1,L)),A,A,A,A,A)><LP(LC(L,C(1,L)),A,A,A,A,A,MC(1,L))><L><L>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [30 90 0 0] 310 0}]
|
|
| 17 | +[GblId, Arity=4, Str=<SP(A,A,SC(S,C(1,L)),A,A,A,A,A)><LP(LC(L,C(1,L)),A,A,A,A,A,MC(1,L))><L><L>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [90 270 0 0] 310 0}]
|
|
| 18 | 18 | f14
|
| 19 | 19 | = \ (@t) ($dOrd :: Ord t) ($dNum :: Num t) (eta :: t) (eta1 :: t) ->
|
| 20 | 20 | let {
|
| ... | ... | @@ -25,7 +25,7 @@ f14 |
| 25 | 25 | f3 [Occ=LoopBreaker, Dmd=SC(S,C(1,L))] :: t -> t -> t -> t
|
| 26 | 26 | [LclId, Arity=2, Str=<L><L>, Unf=OtherCon []]
|
| 27 | 27 | f3
|
| 28 | - = \ (n :: t) (x :: t) ->
|
|
| 28 | + = \ (n :: t) (x [OS=OneShot] :: t) ->
|
|
| 29 | 29 | case < @t $dOrd x n of {
|
| 30 | 30 | False -> F14.f1 @t;
|
| 31 | 31 | True ->
|
| ... | ... | @@ -10,7 +10,7 @@ f :: forall a b. C a b => a -> b |
| 10 | 10 | Str=<1P(A,1C(1,C(1,L)))><L>,
|
| 11 | 11 | Unf=Unf{Src=<vanilla>, TopLvl=True,
|
| 12 | 12 | Value=True, ConLike=True, WorkFree=True, Expandable=True,
|
| 13 | - Guidance=IF_ARGS [30 0] 40 0}]
|
|
| 13 | + Guidance=IF_ARGS [90 0] 40 0}]
|
|
| 14 | 14 | f = \ (@a) (@b) ($dC :: C a b) (x :: a) -> op @a @b $dC x x
|
| 15 | 15 | |
| 16 | 16 |