From 7eb46a09e2188e64d226b75361b36ab732b5b372 Mon Sep 17 00:00:00 2001 From: Sebastian Graf Date: Mon, 5 Oct 2020 15:24:39 +0200 Subject: Arity: Refactor fixed-point iteration in GHC.Core.Opt.Arity Arity analysis used to propagate optimistic arity types during fixed-point interation through the `ArityEnv`'s `ae_cheap_fun` field, which is like `GHC.Core.Utils.exprIsCheap`, but also considers the current iteration's optimistic arity, for the binder in question only. In #18793, we have seen that this is a problematic design, because it doesn't allow us to look through PAP bindings of that binder. Hence this patch refactors to a more traditional form with an explicit signature environment, in which we record the optimistic `ArityType` of the binder in question (and at the moment is the *only* binder that is recorded in the arity environment). --- testsuite/tests/simplCore/should_compile/T18231.stderr | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'testsuite') diff --git a/testsuite/tests/simplCore/should_compile/T18231.stderr b/testsuite/tests/simplCore/should_compile/T18231.stderr index 445192538b..ee5f474423 100644 --- a/testsuite/tests/simplCore/should_compile/T18231.stderr +++ b/testsuite/tests/simplCore/should_compile/T18231.stderr @@ -1,6 +1,6 @@ ==================== Tidy Core ==================== -Result size of Tidy Core = {terms: 30, types: 22, coercions: 5, joins: 0/0} +Result size of Tidy Core = {terms: 24, types: 20, coercions: 5, joins: 0/0} -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} T18231.$trModule4 :: GHC.Prim.Addr# @@ -23,14 +23,14 @@ T18231.$trModule :: GHC.Types.Module T18231.$trModule = GHC.Types.Module T18231.$trModule3 T18231.$trModule1 Rec { --- RHS size: {terms: 6, types: 1, coercions: 0, joins: 0/0} -lvl :: GHC.Prim.Int# -> Data.Functor.Identity.Identity ((), Int) -lvl = \ (x :: GHC.Prim.Int#) -> T18231.m1 (GHC.Types.I# (GHC.Prim.+# x 1#)) +-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0} +lvl :: Data.Functor.Identity.Identity ((), Int) +lvl = lvl +end Rec } --- RHS size: {terms: 6, types: 3, coercions: 0, joins: 0/0} +-- RHS size: {terms: 5, types: 3, coercions: 0, joins: 0/0} T18231.m1 :: Int -> Data.Functor.Identity.Identity ((), Int) -T18231.m1 = \ (s1 :: Int) -> case s1 of { GHC.Types.I# x -> lvl x } -end Rec } +T18231.m1 = \ (eta2 :: Int) -> case eta2 of { GHC.Types.I# x -> lvl } -- RHS size: {terms: 1, types: 0, coercions: 5, joins: 0/0} m :: State Int () -- cgit v1.2.1