[Git][ghc/ghc][wip/nested-cpr-2019] 60 commits: Optimize NthCo (FunCo ...) in coercion opt

Sebastian Graf gitlab at gitlab.haskell.org
Fri Oct 2 11:54:25 UTC 2020



Sebastian Graf pushed to branch wip/nested-cpr-2019 at Glasgow Haskell Compiler / GHC


Commits:
583a2070 by Richard Eisenberg at 2020-09-29T00:31:27-04:00
Optimize NthCo (FunCo ...) in coercion opt

We were missing this case previously.

Close #18528.

Metric Decrease:
    T18223
    T5321Fun

- - - - -
b31a3360 by Krzysztof Gogolewski at 2020-09-29T00:32:05-04:00
Linear types: fix kind inference when checking datacons

- - - - -
5830a12c by Vladislav Zavialov at 2020-09-29T00:32:05-04:00
New linear types syntax: a %p -> b (#18459)

Implements GHC Proposal #356

Updates the haddock submodule.

- - - - -
bca4d36d by Vladislav Zavialov at 2020-09-29T00:32:05-04:00
Improve error messages for (a %m) without LinearTypes

Detect when the user forgets to enable the LinearTypes
extension and produce a better error message.

Steals the (a %m) syntax from TypeOperators, the workaround
is to write (a % m) instead.

- - - - -
b9635d0a by Benjamin Maurer at 2020-09-29T00:32:43-04:00
Description of flag `-H` was in 'verbosity options', moved to 'misc'.
Fixes #18699

- - - - -
74c797f6 by Benjamin Maurer at 2020-09-29T00:33:20-04:00
Workaround for #18623: GHC crashes bc. under rlimit for vmem it will reserve
_all_ of it, leaving nothing for, e.g., thread stacks.
Fix will only allocate 2/3rds and check whether remainder is at least large
enough for minimum amount of thread stacks.

- - - - -
4365d77a by Ryan Scott at 2020-09-29T00:33:57-04:00
Add regression test #18501

ghc/ghc!3220 ended up fixing #18501. This patch adds a regression
test for #18501 to ensure that it stays fixed.

- - - - -
8e3f00dd by Sylvain Henry at 2020-09-29T17:24:03+02:00
Make the parser module less dependent on DynFlags

Bump haddock submodule

- - - - -
3ab0d8f7 by Sebastian Graf at 2020-09-30T02:48:27-04:00
PmCheck: Long-distance information for LocalBinds (#18626)

Now `desugarLocalBind` (formerly `desugarLet`) reasons about

  * `FunBind`s that
    * Have no pattern matches (so which aren't functions)
    * Have a singleton match group with a single GRHS
    * (which may have guards)
  * and looks through trivial post-typechecking `AbsBinds` in doing so
    to pick up the introduced renamings.

And desugars to `PmLet` LYG-style guards. Since GRHSs are no longer
denoted simply by `NonEmpty PmGRHS`, but also need to carry a `[PmGrd]`
for the `PmLet`s from `LocalBind`s, I added `PmGRHSs` to capture that.

Since we call out to the desugarer more often, I found that there were
superfluous warnings emitted when desugaring e.g. case expressions.
Thus, I made sure that we deactivate any warnings in the LYG desugaring
steps by the new wrapper function `noCheckDs`.

There's a regression test in `T18626`. Fixes #18626.

- - - - -
f8f60efc by Ben Gamari at 2020-09-30T02:49:03-04:00
testsuite: Mark T12971 as broken on Windows

Due to #17945.

- - - - -
6527fc57 by Ben Gamari at 2020-09-30T02:49:03-04:00
Bump Cabal, hsc2hs, directory, process submodules

Necessary for recent Win32 bump.

- - - - -
df3f5880 by Sylvain Henry at 2020-09-30T02:49:41-04:00
Remove unsafeGlobalDynFlags (#17957, #14597)

There are still global variables but only 3 booleans instead of a single
DynFlags.

- - - - -
9befd94d by Sylvain Henry at 2020-09-30T02:49:41-04:00
Remove unused global variables

Some removed globals variables were still declared in the RTS.

They were removed in the following commits:

* 4fc6524a2a4a0003495a96c8b84783286f65c198
* 0dc7985663efa1739aafb480759e2e2e7fca2a36
* bbd3c399939311ec3e308721ab87ca6b9443f358

- - - - -
7c98699f by Richard Eisenberg at 2020-09-30T02:50:17-04:00
Omit redundant kind equality check in solver

See updated Note [Use loose types in inert set] in
GHC.Tc.Solver.Monad.

Close #18753.

- - - - -
39549826 by Sebastian Graf at 2020-09-30T02:50:54-04:00
Pmc: Don't call exprType on type arguments (#18767)

Fixes #18767.

- - - - -
235e410f by Richard Eisenberg at 2020-09-30T02:51:29-04:00
Regression test for #10709.

Close #10709

- - - - -
5c32655f by Ben Gamari at 2020-09-30T22:31:55-04:00
hadrian/doc: Clarify documentation of key-value configuration
- - - - -
0bb02873 by Sylvain Henry at 2020-10-01T18:34:53-04:00
Add test for T18574

- - - - -
e393f213 by Sylvain Henry at 2020-10-01T18:34:53-04:00
Allow fusion with catMaybes (#18574)

Metric Decrease:
   T18574

- - - - -
d2cfad96 by Fendor at 2020-10-01T18:35:33-04:00
Add mainModuleNameIs and demote mainModIs

Add `mainModuleNameIs` to DynFlags and demote
`mainModIs` to function which uses the homeUnit from DynFlags
it is created from.

- - - - -
fc351ab8 by Fendor at 2020-10-01T18:35:33-04:00
Use HomeUnit for main module without module declaration

- - - - -
dca1cb22 by Fendor at 2020-10-01T18:35:33-04:00
Remove mAIN completely

- - - - -
a5aaceec by Sylvain Henry at 2020-10-01T18:36:11-04:00
Use ADTs for parser errors/warnings

Haskell and Cmm parsers/lexers now report errors and warnings using ADTs
defined in GHC.Parser.Errors. They can be printed using functions in
GHC.Parser.Errors.Ppr.

Some of the errors provide hints with a separate ADT (e.g. to suggest to
turn on some extension). For now, however, hints are not consistent
across all messages. For example some errors contain the hints in the
main message. I didn't want to change any message with this patch. I
expect these changes to be discussed and implemented later.

Surprisingly, this patch enhances performance. On CI
(x86_64/deb9/hadrian, ghc/alloc):

   parsing001         -11.5%
   T13719             -2.7%
   MultiLayerModules  -3.5%
   Naperian           -3.1%

Bump haddock submodule

Metric Decrease:
    MultiLayerModules
    Naperian
    T13719
    parsing001

- - - - -
a946c7ef by Sylvain Henry at 2020-10-01T18:36:11-04:00
Less DynFlags in Header parsing

- - - - -
dafe7943 by Sylvain Henry at 2020-10-01T18:36:11-04:00
Parser: remove some unused imports

These are not reported by GHC because Happy adds {-# OPTIONS_GHC -w #-}

- - - - -
93d5de16 by Sylvain Henry at 2020-10-01T18:36:11-04:00
Don't import GHC.Unit to reduce the number of dependencies

- - - - -
e3655f81 by Sebastian Graf at 2020-10-01T18:36:47-04:00
Don't attach CPR signatures to NOINLINE data structures (#18154)

Because the generated `KindRep`s don't have an unfolding, !3230 did not
actually stop to compute, attach and serialise unnecessary CPR
signatures for them. As already said in
`Note [CPR for data structures]`, that leads to bloated interface
files which is ultimately quadratic for Nested CPR.

So we don't attach any CPR signature to bindings that

  * Are not thunks (because thunks are not in WHNF)
  * Have arity 0 (which means the top-level constructor is not a lambda)

If the data structure has an unfolding, we continue to look through it.
If not (as is the case for `KindRep`s), we look at the unchanged CPR
signature and see `topCprType`, as expected.

- - - - -
ba5965eb by Richard Eisenberg at 2020-10-01T18:37:23-04:00
Add regression test for #18755.

Close #18755

- - - - -
a8018c17 by Vladislav Zavialov at 2020-10-01T18:37:58-04:00
Fix pretty-printing of the mult-polymorphic arrow

A follow-up to !4020 (5830a12c46e7227c276a8a71213057595ee4fc04)

- - - - -
e5523324 by Sylvain Henry at 2020-10-01T18:38:35-04:00
Bignum: add integerNegate RULE

- - - - -
1edd6d21 by Vladislav Zavialov at 2020-10-01T18:39:10-04:00
Refactor: remove rnHsDoc

It did not do any useful work.

- - - - -
e683d1de by Sebastian Graf at 2020-10-02T12:18:25+02:00
Nested CPR

- - - - -
b2d21f7b by Sebastian Graf at 2020-10-02T12:18:27+02:00
Move tests from stranal to cpranal

- - - - -
0ae3a61b by Sebastian Graf at 2020-10-02T12:18:27+02:00
Accept FacState

- - - - -
0e89f542 by Sebastian Graf at 2020-10-02T12:22:52+02:00
Factor Cpr and Termination into a joint lattice

As a result, we don't even have to export Termination from Cpr. Neat!

Also I realised there is a simpler and more sound way to generate and
unleash CPR signatures.

- - - - -
793f96f1 by Sebastian Graf at 2020-10-02T13:26:15+02:00
Consider unboxing effects of WW better and get rid of hack

- - - - -
3d133e95 by Sebastian Graf at 2020-10-02T13:26:17+02:00
stuff

- - - - -
73016804 by Sebastian Graf at 2020-10-02T13:28:21+02:00
A slew of testsuite changes

- - - - -
4cfd952b by Sebastian Graf at 2020-10-02T13:28:22+02:00
Fix T1600

- - - - -
51597247 by Sebastian Graf at 2020-10-02T13:28:22+02:00
Inline `decodeDoubleInteger` and constant-fold `decodeDouble_Int64#` instead

Currently, `decodeDoubleInteger` is known-key so that it can be
recognised in constant folding. But that is very brittle and doesn't
survive worker/wrapper, which we even do for
`NOINLINE`/`CONSTANT_FOLDED` things since #13143.
Also it is a trade-off: The implementation of `decodeDoubleInteger`
allocates an `Integer` box that never cancels aways if we don't inline
it.

Hence we recognise the `decodeDouble_Int64#` primop instead in constant
folding, so that we can inline `decodeDoubleInteger`.

You may wonder how this affects performance of code using
`integer-simple`; Apparently, according to @hsyl20 this is not a concern
since we will hopefully land !2231 soon.

Fixes #18092.

- - - - -
44c4ee7f by Sebastian Graf at 2020-10-02T13:28:22+02:00
Fix primop termination

- - - - -
db1cef64 by Sebastian Graf at 2020-10-02T13:28:22+02:00
Test for DataCon wrapper CPR

- - - - -
80eacba9 by Sebastian Graf at 2020-10-02T13:29:36+02:00
Fix CPR of bottoming functions/primops

- - - - -
408cc9ef by Sebastian Graf at 2020-10-02T13:29:38+02:00
Fix DataConWrapperCpr and accept other test outputs

- - - - -
13af2d36 by Sebastian Graf at 2020-10-02T13:29:38+02:00
Accept two more changed test outputs

- - - - -
289a33d0 by Sebastian Graf at 2020-10-02T13:29:38+02:00
Update CaseBinderCPR with a new function

- - - - -
a16dd70e by Sebastian Graf at 2020-10-02T13:30:09+02:00
Don't give the case binder the CPR property

- - - - -
df0fa09e by Sebastian Graf at 2020-10-02T13:31:36+02:00
Prune CPR sigs to constant depth on all bindings

- - - - -
1277ee1e by Sebastian Graf at 2020-10-02T13:31:37+02:00
Use variable length coding for ConTags

- - - - -
157825a0 by Sebastian Graf at 2020-10-02T13:33:52+02:00
Accept testuite output

- - - - -
3dc83f0e by Sebastian Graf at 2020-10-02T13:33:54+02:00
Don't attach CPR sigs to expandable bindings; transform their unfoldings instead

- - - - -
f9f60b4a by Sebastian Graf at 2020-10-02T13:34:34+02:00
Revert "Don't give the case binder the CPR property"

This reverts commit 910edd76d5fe68b58c74f3805112f9faef4f2788.

It seems we broke too much with this change. We lost our big win in
`fish`.

- - - - -
39d8fef7 by Sebastian Graf at 2020-10-02T13:35:52+02:00
A more modular and configurable approach to optimistic case binder CPR

- - - - -
cd7312c2 by Sebastian Graf at 2020-10-02T13:35:53+02:00
Fix T9291

- - - - -
1b359995 by Sebastian Graf at 2020-10-02T13:35:53+02:00
Document -fcase-binder-cpr-depth in the user's guide

- - - - -
0e1dbf0e by Sebastian Graf at 2020-10-02T13:35:53+02:00
Testsuite changes

- - - - -
94e39399 by Sebastian Graf at 2020-10-02T13:45:46+02:00
Refactoring around cprAnalBind

- - - - -
933e699a by Sebastian Graf at 2020-10-02T13:52:11+02:00
Fix case binder CPR by not looking into unfoldings of case binders

- - - - -
a508a5f1 by Sebastian Graf at 2020-10-02T13:52:18+02:00
Regard all arity 0 bindings (incl. DataCon apps) as thunks

- - - - -
6cb20f84 by Sebastian Graf at 2020-10-02T13:53:48+02:00
Don't store CPR info for data structures that are NOINLINE

- - - - -


30 changed files:

- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/ByteCode/Linker.hs
- compiler/GHC/Cmm/CLabel.hs
- compiler/GHC/Cmm/Lexer.x
- compiler/GHC/Cmm/Monad.hs
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/InstEnv.hs
- compiler/GHC/Core/Make.hs
- compiler/GHC/Core/Multiplicity.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/Monad.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Unfold.hs
- compiler/GHC/CoreToIface.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/dac38be5dbeea5a7a03c2c7cb2f893f97ac7f4bb...6cb20f84d98844f1d7970ded6be867d99590fc34

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/dac38be5dbeea5a7a03c2c7cb2f893f97ac7f4bb...6cb20f84d98844f1d7970ded6be867d99590fc34
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/20201002/b64db941/attachment-0001.html>


More information about the ghc-commits mailing list