Commit 7eb46a09 authored by Sebastian Graf's avatar Sebastian Graf Committed by Marge Bot

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).
parent 59d7c9f4
This diff is collapsed.
==================== 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 ()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment