diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2021-10-07 11:20:01 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-10-20 17:49:07 -0400 |
commit | 758e0d7bbe517b67fb20c3fb591e76b65b2959af (patch) | |
tree | c1d13337f70da7b73298c941117f10f03432a503 /testsuite | |
parent | 0b575899eca29a89ff18d84e0daa63ec35358976 (diff) | |
download | haskell-758e0d7bbe517b67fb20c3fb591e76b65b2959af.tar.gz |
Bignum: allow Integer predicates to inline (#20361)
T17516 allocations increase by 48% because Integer's predicates are
inlined in some Ord instance methods. These methods become too big to be
inlined while they probably should: this is tracked in #20516.
Metric Increase:
T17516
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/arityanal/should_compile/Arity02.stderr | 33 | ||||
-rw-r--r-- | testsuite/tests/arityanal/should_compile/Arity09.stderr | 32 |
2 files changed, 35 insertions, 30 deletions
diff --git a/testsuite/tests/arityanal/should_compile/Arity02.stderr b/testsuite/tests/arityanal/should_compile/Arity02.stderr index 576718aff4..8f9c4eec08 100644 --- a/testsuite/tests/arityanal/should_compile/Arity02.stderr +++ b/testsuite/tests/arityanal/should_compile/Arity02.stderr @@ -1,38 +1,43 @@ ==================== Tidy Core ==================== -Result size of Tidy Core = {terms: 35, types: 23, coercions: 0, joins: 0/0} +Result size of Tidy Core = {terms: 51, types: 27, coercions: 0, joins: 0/0} --- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} F2.f1 :: Integer -[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}] -F2.f1 = 0 +[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] +F2.f1 = GHC.Num.Integer.IS 0# -- RHS size: {terms: 7, types: 6, coercions: 0, joins: 0/0} f2f :: forall {t1} {t2}. (t1 -> Integer -> t2) -> t1 -> t2 [GblId, Arity=2, Str=<1C1(C1(L))><L>, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=ALWAYS_IF(arity=2,unsat_ok=True,boring_ok=True)}] f2f = \ (@t) (@t1) (h :: t -> Integer -> t1) (x :: t) -> h x F2.f1 --- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} lvl :: Integer [GblId, Unf=OtherCon []] -lvl = 1 +lvl = GHC.Num.Integer.IS 1# Rec { --- RHS size: {terms: 16, types: 3, coercions: 0, joins: 0/0} +-- RHS size: {terms: 29, types: 7, coercions: 0, joins: 0/0} F2.f2_g [Occ=LoopBreaker] :: Integer -> Integer -> Integer -[GblId, Arity=2, Str=<SL><SL>, Unf=OtherCon []] +[GblId, Arity=2, Str=<1L><SL>, Unf=OtherCon []] F2.f2_g = \ (x :: Integer) (y :: Integer) -> - case GHC.Num.Integer.integerGt# x F2.f1 of { - __DEFAULT -> y; - 1# -> F2.f2_g (GHC.Num.Integer.integerSub x lvl) (GHC.Num.Integer.integerAdd x y) + case x of wild { + GHC.Num.Integer.IS x1 -> + case GHC.Prim.># x1 0# of { + __DEFAULT -> y; + 1# -> F2.f2_g (GHC.Num.Integer.integerSub wild lvl) (GHC.Num.Integer.integerAdd wild y) + }; + GHC.Num.Integer.IP x1 -> F2.f2_g (GHC.Num.Integer.integerSub wild lvl) (GHC.Num.Integer.integerAdd wild y); + GHC.Num.Integer.IN x1 -> y } end Rec } --- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} F2.f3 :: Integer -[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}] -F2.f3 = 5 +[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] +F2.f3 = GHC.Num.Integer.IS 5# -- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0} f2 :: Integer diff --git a/testsuite/tests/arityanal/should_compile/Arity09.stderr b/testsuite/tests/arityanal/should_compile/Arity09.stderr index 7d24fdeb86..e43de277b7 100644 --- a/testsuite/tests/arityanal/should_compile/Arity09.stderr +++ b/testsuite/tests/arityanal/should_compile/Arity09.stderr @@ -1,31 +1,31 @@ ==================== Tidy Core ==================== -Result size of Tidy Core = {terms: 25, types: 8, coercions: 0, joins: 0/0} +Result size of Tidy Core = {terms: 38, types: 11, coercions: 0, joins: 0/0} --- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} lvl :: Integer [GblId, Unf=OtherCon []] -lvl = 100 - --- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} -lvl1 :: Integer -[GblId, Unf=OtherCon []] -lvl1 = 11 +lvl = GHC.Num.Integer.IS 11# --- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0} F9.f1 :: Integer -[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 100 0}] -F9.f1 = 10 +[GblId, Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True, WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 10 10}] +F9.f1 = GHC.Num.Integer.IS 10# Rec { --- RHS size: {terms: 15, types: 2, coercions: 0, joins: 0/0} +-- RHS size: {terms: 28, types: 6, coercions: 0, joins: 0/0} F9.f91_f [Occ=LoopBreaker] :: Integer -> Integer -[GblId, Arity=1, Str=<SL>, Unf=OtherCon []] +[GblId, Arity=1, Str=<1L>, Unf=OtherCon []] F9.f91_f = \ (n :: Integer) -> - case GHC.Num.Integer.integerLe# n lvl of { - __DEFAULT -> GHC.Num.Integer.integerSub n F9.f1; - 1# -> F9.f91_f (F9.f91_f (GHC.Num.Integer.integerAdd n lvl1)) + case n of wild { + GHC.Num.Integer.IS x1 -> + case GHC.Prim.<=# x1 100# of { + __DEFAULT -> GHC.Num.Integer.integerSub wild F9.f1; + 1# -> F9.f91_f (F9.f91_f (GHC.Num.Integer.integerAdd wild lvl)) + }; + GHC.Num.Integer.IP x1 -> GHC.Num.Integer.integerSub wild F9.f1; + GHC.Num.Integer.IN x1 -> F9.f91_f (F9.f91_f (GHC.Num.Integer.integerAdd wild lvl)) } end Rec } |