Refactor fixed-point iteration in GHC.Core.Opt.Arity
First commit:
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 (closed), 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).
Second commit:
After the refactoring, the needed change is quite simple and very local to arityType
's defn for non-recursive Let
.
Apart from that, we had to get rid of the second item of Note [Dealing with bottoms]
, which was entirely a safety measure and hindered optimistic fixed-point iteration.
Third commit:
Just add some previously dead arity analysis tests.