[Git][ghc/ghc][wip/T18793] 3 commits: Arity: Refactor fixed-point iteration in GHC.Core.Opt.Arity

Sebastian Graf gitlab at gitlab.haskell.org
Fri Oct 9 09:01:58 UTC 2020



Sebastian Graf pushed to branch wip/T18793 at Glasgow Haskell Compiler / GHC


Commits:
a6dc4633 by Sebastian Graf at 2020-10-09T11:01:16+02:00
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).

- - - - -
8a5f97cb by Sebastian Graf at 2020-10-09T11:01:42+02:00
Arity analysis: Record arity types for non-recursive lets

In #18793, we saw a compelling example which requires us to look at
non-recursive let-bindings during arity analysis and unleash their arity
types at use sites.

After the refactoring in the previous patch, the needed change is quite
simple and very local to `arityType`'s defn for non-recurisve `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.

Fixes #18793.

- - - - -
9d61d7fe by Sebastian Graf at 2020-10-09T11:01:50+02:00
Testsuite: Add dead arity analysis tests

We didn't seem to test these old tests at all, judging from their
expected output.

- - - - -


30 changed files:

- compiler/GHC/Core/Opt/Arity.hs
- − testsuite/tests/arityanal/Main.hs
- − testsuite/tests/arityanal/Main.stderr
- testsuite/tests/arityanal/Makefile
- − testsuite/tests/arityanal/f0.stderr
- − testsuite/tests/arityanal/f1.stderr
- − testsuite/tests/arityanal/f10.stderr
- − testsuite/tests/arityanal/f11.stderr
- − testsuite/tests/arityanal/f13.stderr
- − testsuite/tests/arityanal/f14.stderr
- − testsuite/tests/arityanal/f15.stderr
- − testsuite/tests/arityanal/f2.stderr
- − testsuite/tests/arityanal/f3.stderr
- − testsuite/tests/arityanal/f4.stderr
- − testsuite/tests/arityanal/f5.stderr
- − testsuite/tests/arityanal/f6.stderr
- − testsuite/tests/arityanal/f7.stderr
- − testsuite/tests/arityanal/f8.stderr
- − testsuite/tests/arityanal/f9.stderr
- − testsuite/tests/arityanal/prim.stderr
- testsuite/tests/arityanal/f0.hs → testsuite/tests/arityanal/should_compile/Arity00.hs
- + testsuite/tests/arityanal/should_compile/Arity00.stderr
- testsuite/tests/arityanal/f1.hs → testsuite/tests/arityanal/should_compile/Arity01.hs
- + testsuite/tests/arityanal/should_compile/Arity01.stderr
- testsuite/tests/arityanal/f2.hs → testsuite/tests/arityanal/should_compile/Arity02.hs
- + testsuite/tests/arityanal/should_compile/Arity02.stderr
- testsuite/tests/arityanal/f3.hs → testsuite/tests/arityanal/should_compile/Arity03.hs
- + testsuite/tests/arityanal/should_compile/Arity03.stderr
- testsuite/tests/arityanal/f4.hs → testsuite/tests/arityanal/should_compile/Arity04.hs
- + testsuite/tests/arityanal/should_compile/Arity04.stderr


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/afb26d12794f98f55e35f5c8115b93ca1f77c686...9d61d7fe431486768ed10d53b9f10887bf8bdc06

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/afb26d12794f98f55e35f5c8115b93ca1f77c686...9d61d7fe431486768ed10d53b9f10887bf8bdc06
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20201009/90fd67ed/attachment.html>


More information about the ghc-commits mailing list