[Git][ghc/ghc][wip/nested-cpr-2019] 45 commits: Fall back to types when looking up data constructors (#18740)

Sebastian Graf gitlab at gitlab.haskell.org
Thu Oct 15 08:46:30 UTC 2020



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


Commits:
990ea991 by Daniel Rogozin at 2020-10-11T22:20:04+03:00
Fall back to types when looking up data constructors (#18740)

Before this patch, referring to a data constructor in a term-level
context led to a scoping error:

    ghci> id Int
    <interactive>:1:4: error: Data constructor not in scope: Int

After this patch, the renamer falls back to the type namespace
and successfully finds the Int. It is then rejected in the type
checker with a more useful error message:

    <interactive>:1:4: error:
    • Illegal term-level use of the type constructor ‘Int’
        imported from ‘Prelude’ (and originally defined in ‘GHC.Types’)
    • In the first argument of ‘id’, namely ‘Int’
      In the expression: id Int

We also do this for type variables.

- - - - -
9bbc84d2 by Sylvain Henry at 2020-10-12T18:21:51-04:00
DynFlags: refactor DmdAnal

Make demand analysis usable without having to provide DynFlags.

- - - - -
7fdcce6d by Wander Hillen at 2020-10-13T00:12:47-04:00
Initial ShortText code and conversion of package db code

Metric Decrease:
    Naperian
    T10421
    T10421a
    T10547
    T12150
    T12234
    T12425
    T13035
    T18140
    T18304
    T5837
    T6048
    T13253-spj
    T18282
    T18223
    T3064
    T9961
Metric Increase
    T13701

HFSKJH

- - - - -
0a5f2918 by Sylvain Henry at 2020-10-13T00:13:28-04:00
Parser: don't require the HomeUnitId

The HomeUnitId is only used by the Cmm parser and this one has access to
the DynFlags, so it can grab the UnitId of the HomeUnit from them.

Bump haddock submodule

- - - - -
8f4f5794 by HaskellMouse at 2020-10-13T13:05:49+03:00
Unification of Nat and Naturals

This commit removes the separate kind 'Nat' and enables promotion
of type 'Natural' for using as type literal.
It partially solves #10776

Now the following code will be successfully typechecked:
    data C = MkC Natural
    type CC = MkC 1

Before this change we had to create the separate type for promotion
    data C = MkC Natural
    data CP = MkCP Nat
    type CC = MkCP 1

But CP is uninhabited in terms.

For backward compatibility type synonym `Nat` has been made:
    type Nat = Natural

The user's documentation and tests have been updated.
The haddock submodule also have been updated.

- - - - -
0fc1cb54 by Ben Gamari at 2020-10-14T03:42:50-04:00
gitlab-ci: Verify that Hadrian builds with Stack

As noted in #18726, this regularly breaks. Let's test it.

Note that we don't actually perform a build of GHC itself; we merely
test that the Hadrian executable builds and works (by invoking `hadrian
--version`).

- - - - -
89f4d8e9 by Ben Gamari at 2020-10-14T12:03:57-04:00
Bump LLVM version to 10.0

Fixes #18267.

- - - - -
716385c9 by Ryan Scott at 2020-10-14T12:04:34-04:00
Make DataKinds the sole arbiter of kind-level literals (and friends)

Previously, the use of kind-level literals, promoted tuples,
and promoted lists required enabling both `DataKinds` and
`PolyKinds`. This made sense back in a `TypeInType` world, but not so
much now that `TypeInType`'s role has been superseded. Nowadays,
`PolyKinds` only controls kind polymorphism, so let's make `DataKinds`
the thing that controls the other aspects of `TypeInType`, which include
literals, promoted tuples and promoted lists.

There are some other things that overzealously required `PolyKinds`,
which this patch fixes as well:

* Previously, using constraints in kinds (e.g., `data T :: () -> Type`)
  required `PolyKinds`, despite the fact that this is orthogonal to kind
  polymorphism. This now requires `DataKinds` instead.
* Previously, using kind annotations in kinds
  (e.g., `data T :: (Type :: Type) -> Type`) required both `KindSignatures`
  and `PolyKinds`. This doesn't make much sense, so it only requires
  `KindSignatures` now.

Fixes #18831.

- - - - -
ac300a0d by Vladislav Zavialov at 2020-10-14T12:05:11-04:00
Remove "Operator sections" from docs/users_guide/bugs.rst

The issue described in that section was fixed by
2b89ca5b850b4097447cc4908cbb0631011ce979

- - - - -
bf2411a3 by Vladislav Zavialov at 2020-10-14T12:05:11-04:00
Fix PostfixOperators (#18151)

This fixes a regression introduced in 2b89ca5b850b4097447cc4908cbb0631011ce979
See the new T18151x test case.

- - - - -
e60ae8a3 by Fumiaki Kinoshita at 2020-10-14T18:06:12-04:00
Add -Wnoncanonical-{monad,monoid}-instances to standardWarnings

-------------------------
Metric Decrease:
   T12425
Metric Increase:
   T17516
-------------------------

- - - - -
15d2340c by Simon Peyton Jones at 2020-10-14T18:06:48-04:00
Fix some missed opportunities for preInlineUnconditionally

There are two signficant changes here:

* Ticket #18815 showed that we were missing some opportunities for
  preInlineUnconditionally.  The one-line fix is in the code for
  GHC.Core.Opt.Simplify.Utils.preInlineUnconditionally, which now
  switches off only for INLINE pragmas.  I expanded
  Note [Stable unfoldings and preInlineUnconditionally] to explain.

* When doing this I discovered a way in which preInlineUnconditionally
  was occasionally /too/ eager.  It's all explained in
  Note [Occurrences in stable unfoldings] in GHC.Core.Opt.OccurAnal,
  and the one-line change adding markAllMany to occAnalUnfolding.

I also got confused about what NoUserInline meant, so I've renamed
it to NoUserInlinePrag, and changed its pretty-printing slightly.
That led to soem error messate wibbling, and touches quite a few
files, but there is no change in functionality.

I did a nofib run.  As expected, no significant changes.

        Program           Size    Allocs
----------------------------------------
         sphere          -0.0%     -0.4%
----------------------------------------
            Min          -0.0%     -0.4%
            Max          -0.0%     +0.0%
 Geometric Mean          -0.0%     -0.0%

I'm allowing a max-residency increase for T10370, which seems
very irreproducible. (See comments on !4241.)  There is always
sampling error for max-residency measurements; and in any case
the change shows up on some platforms but not others.

Metric Increase:
    T10370

- - - - -
0c4bfed8 by Ben Gamari at 2020-10-14T18:07:25-04:00
users-guide: Add missing :ghc-flag: directive
- - - - -
51c4b851 by Krzysztof Gogolewski at 2020-10-15T04:30:27-04:00
Remove Proxy# argument in Data.Typeable.Internal

No longer neccessary - TypeRep is now indexed, there is no ambiguity.

Also fix a comment in Evidence.hs, IsLabel no longer takes a Proxy#.

- - - - -
809f09e8 by Sylvain Henry at 2020-10-15T04:31:07-04:00
Fix parsing of PIE flags

-fPIE and -fno-PIE flags were (un)setting Opt_PIC instead of Opt_PIE.

Original commit: 3625728a0e3a9b56c2b85ae7ea8bcabdd83ece6a

- - - - -
3d7db148 by Ben Gamari at 2020-10-15T04:31:42-04:00
testsuite: Add missing #include on <stdlib.h>

This otherwise fails on newer Clangs, which warn
more aggressively on undeclared symbols.
- - - - -
76cf4569 by Sebastian Graf at 2020-10-15T10:45:46+02:00
Nested CPR

- - - - -
f2e99705 by Sebastian Graf at 2020-10-15T10:45:48+02:00
Move tests from stranal to cpranal

- - - - -
86b94dc1 by Sebastian Graf at 2020-10-15T10:45:48+02:00
Accept FacState

- - - - -
3666301c by Sebastian Graf at 2020-10-15T10:45:48+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.

- - - - -
6a274590 by Sebastian Graf at 2020-10-15T10:45:48+02:00
Consider unboxing effects of WW better and get rid of hack

- - - - -
d4412216 by Sebastian Graf at 2020-10-15T10:45:48+02:00
stuff

- - - - -
70e852f0 by Sebastian Graf at 2020-10-15T10:45:48+02:00
A slew of testsuite changes

- - - - -
7df43bac by Sebastian Graf at 2020-10-15T10:45:48+02:00
Fix T1600

- - - - -
3f9b2f7f by Sebastian Graf at 2020-10-15T10:45:48+02:00
Fix primop termination

- - - - -
9f9cb6c7 by Sebastian Graf at 2020-10-15T10:45:48+02:00
Test for DataCon wrapper CPR

- - - - -
f5c64f63 by Sebastian Graf at 2020-10-15T10:45:48+02:00
Fix CPR of bottoming functions/primops

- - - - -
567e66ab by Sebastian Graf at 2020-10-15T10:45:48+02:00
Fix DataConWrapperCpr and accept other test outputs

- - - - -
50e9a93b by Sebastian Graf at 2020-10-15T10:45:48+02:00
Accept two more changed test outputs

- - - - -
4846f157 by Sebastian Graf at 2020-10-15T10:45:48+02:00
Update CaseBinderCPR with a new function

- - - - -
a9692af8 by Sebastian Graf at 2020-10-15T10:45:48+02:00
Don't give the case binder the CPR property

- - - - -
22a94094 by Sebastian Graf at 2020-10-15T10:45:48+02:00
Prune CPR sigs to constant depth on all bindings

- - - - -
473d5b2a by Sebastian Graf at 2020-10-15T10:45:48+02:00
Use variable length coding for ConTags

- - - - -
df7a59f1 by Sebastian Graf at 2020-10-15T10:45:48+02:00
Accept testuite output

- - - - -
2e4f33f3 by Sebastian Graf at 2020-10-15T10:45:48+02:00
Don't attach CPR sigs to expandable bindings; transform their unfoldings instead

- - - - -
b2048e17 by Sebastian Graf at 2020-10-15T10:45:48+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`.

- - - - -
4133de48 by Sebastian Graf at 2020-10-15T10:45:49+02:00
A more modular and configurable approach to optimistic case binder CPR

- - - - -
996147f6 by Sebastian Graf at 2020-10-15T10:45:49+02:00
Fix T9291

- - - - -
0dea2f53 by Sebastian Graf at 2020-10-15T10:45:49+02:00
Document -fcase-binder-cpr-depth in the user's guide

- - - - -
67200d5e by Sebastian Graf at 2020-10-15T10:45:49+02:00
Testsuite changes

- - - - -
9da2dd75 by Sebastian Graf at 2020-10-15T10:45:49+02:00
Refactoring around cprAnalBind

- - - - -
578d73c2 by Sebastian Graf at 2020-10-15T10:45:49+02:00
Fix case binder CPR by not looking into unfoldings of case binders

- - - - -
1e23f24b by Sebastian Graf at 2020-10-15T10:45:49+02:00
Fix T16893

- - - - -
2c26ffe4 by Sebastian Graf at 2020-10-15T10:45:49+02:00
Accept new test output for T17673

- - - - -
546788b5 by Sebastian Graf at 2020-10-15T10:46:19+02:00
Accepting metric changes to advance CI

There are two ghc/alloc increases, which we might want to investigate
later on.

Metric Decrease:
    T1969
    T9233
    T9872a
    T9872b
    T9872c
    T9872d
    T12425
Metric Increase:
    T13253
    T13701
    T15164
Metric Increase ['max_bytes_used'] (test_env='x86_64-darwin'):
    T9675
Metric Increase ['max_bytes_used', 'peak_megabytes_allocated']:
    T10370

- - - - -


30 changed files:

- .gitlab-ci.yml
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types.hs-boot
- compiler/GHC/Builtin/Types/Literals.hs
- compiler/GHC/Cmm/Lexer.x
- compiler/GHC/Cmm/Parser.y
- compiler/GHC/Cmm/Monad.hs → compiler/GHC/Cmm/Parser/Monad.hs
- compiler/GHC/Core/Make.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/CodeOutput.hs
- compiler/GHC/Driver/Config.hs
- compiler/GHC/Driver/Finder.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs/Binds.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4f4bfd687b108199c5cdbc6f093eac4af561a7fa...546788b5119e34f3f7313f01b56eaa7f437422b4

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/4f4bfd687b108199c5cdbc6f093eac4af561a7fa...546788b5119e34f3f7313f01b56eaa7f437422b4
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/20201015/c4a6fc90/attachment-0001.html>


More information about the ghc-commits mailing list