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

Marge Bot gitlab at gitlab.haskell.org
Sun Oct 18 02:02:21 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
7eb46a09 by Sebastian Graf at 2020-10-17T22:02:13-04: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).

- - - - -
6b3eb06a by Sebastian Graf at 2020-10-17T22:02:13-04:00
Arity: 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.

The following metric increases are all caused by this commit and a
result of the fact that we just do more work now:

Metric Increase:
    T3294
    T12545
    T12707

- - - - -
451455fd by Sebastian Graf at 2020-10-17T22:02:13-04: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/f12.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


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/59d7c9f45b034809516703b57c84e3dac1834578...451455fd008500259f5d2207bdfdccf6dddb52c5

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/59d7c9f45b034809516703b57c84e3dac1834578...451455fd008500259f5d2207bdfdccf6dddb52c5
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/20201017/b81ed2b2/attachment.html>


More information about the ghc-commits mailing list