[Git][ghc/ghc][wip/21611-move-corem] 45 commits: testsuite: Add test for #21583

Dominik Peteler (@mmhat) gitlab at gitlab.haskell.org
Sat Aug 20 10:34:13 UTC 2022



Dominik Peteler pushed to branch wip/21611-move-corem at Glasgow Haskell Compiler / GHC


Commits:
714c936f by Bryan Richter at 2022-08-18T18:37:21-04:00
testsuite: Add test for #21583

- - - - -
989b844d by Ben Gamari at 2022-08-18T18:37:57-04:00
compiler: Drop --build-id=none hack

Since 2011 the object-joining implementation has had a hack to pass
`--build-id=none` to `ld` when supported, seemingly to work around a
linker bug. This hack is now unnecessary and may break downstream users
who expect objects to have valid build-ids. Remove it.

Closes #22060.

- - - - -
519c712e by Matthew Pickering at 2022-08-19T00:09:11-04:00
Make ru_fn field strict to avoid retaining Ids

It's better to perform this projection from Id to Name strictly so we
don't retain an old Id (hence IdInfo, hence Unfolding, hence everything
etc)

- - - - -
7dda04b0 by Matthew Pickering at 2022-08-19T00:09:11-04:00
Force `getOccFS bndr` to avoid retaining reference to Bndr.

This is another symptom of #19619

- - - - -
4303acba by Matthew Pickering at 2022-08-19T00:09:11-04:00
Force unfoldings when they are cleaned-up in Tidy and CorePrep

If these thunks are not forced then the entire unfolding for the binding
is live throughout the whole of CodeGen despite the fact it should have
been discarded.

Fixes #22071

- - - - -
2361b3bc by Matthew Pickering at 2022-08-19T00:09:47-04:00
haddock docs: Fix links from identifiers to dependent packages

When implementing the base_url changes I made the pretty bad mistake of
zipping together two lists which were in different orders. The simpler
thing to do is just modify `haddockDependencies` to also return the
package identifier so that everything stays in sync.

Fixes #22001

- - - - -
9a7e2ea1 by Matthew Pickering at 2022-08-19T00:10:23-04:00
Revert "Refactor SpecConstr to use treat bindings uniformly"

This reverts commit 415468fef8a3e9181b7eca86de0e05c0cce31729.

This refactoring introduced quite a severe residency regression (900MB
live from 650MB live when compiling mmark), see #21993 for a reproducer
and more discussion.

Ticket #21993

- - - - -
9789e845 by Zachary Wood at 2022-08-19T14:17:28-04:00
tc: warn about lazy annotations on unlifted arguments (fixes #21951)

- - - - -
e5567289 by Andreas Klebinger at 2022-08-19T14:18:03-04:00
Fix #22048 where we failed to drop rules for -fomit-interface-pragmas.

Now we also filter the local rules (again) which fixes the issue.

- - - - -
51ffd009 by Swann Moreau at 2022-08-19T18:29:21-04:00
Print constraints in quotes (#21167)

This patch improves the uniformity of error message formatting by
printing constraints in quotes, as we do for types.

Fix #21167

- - - - -
ab3e0f5a by Sasha Bogicevic at 2022-08-19T18:29:57-04:00
19217 Implicitly quantify type variables in :kind command

- - - - -
4dd68771 by Dominik Peteler at 2022-08-20T12:06:27+02:00
Move CoreM to GHC.Plugins.Monad

Removes the uses of CoreM in the Specialise, SpecConstr and CallerCC
pass. Since CoreM is now only used by Core2core plugins within the Core
pipeline the monad got moved to an own module.

Additionally CoreToDo and related types got moved to an own module
GHC.Core.Opt.Pipeline.Types.

Moved the remaining code from GHC.Core.Opt.Monad to GHC.Core.Opt.Utils.

GHC.Core.Opt.{SpecConstr,CallerCC} got proper configs / the usual treatment.

Split out GHC.Core.Opt.CallerCC.Filter to avoid hs-boot.

Removed explicit PrintUnqualified argument from `endPassIO`

Removed `CoreToDo` from GHC.Core.Lint and GHC.CoreToStg.Prep

Fixes #21611.

- - - - -
1573d899 by Dominik Peteler at 2022-08-20T12:06:35+02:00
Removed CoreM uses from GHC.Core.Lint

- - - - -
958e96b9 by Dominik Peteler at 2022-08-20T12:28:25+02:00
Purified GHC.Core.LateCC.addLateCostCentres

 * GHC.Driver.Config.Core.Lint:
    * Removed: endPass
    * Renamed: endPassHscEnvIO -> endPass
 * Moved GHC.Core.Opt.Pipeline.initLintAnnotationsConfig to
   GHC.Driver.Config.Core.Lint

- - - - -
b58cf2f8 by Dominik Peteler at 2022-08-20T12:28:34+02:00
Run the CoreToDo interpreter in an own monad `SimplCountM`

This monad is just `StateT SimplCount IO` wrapped in a newtype.
This way we get rid of some `Core.Opt.Pipeline` boilerplate.

It lives in GHC.Core.Opt.Counting and `Tick` and `SimplCount` got moved
there as well.

Also:
 * GHC.Core.Opt.Pipeline.runCorePasses: Take logger service as an
   argument

- - - - -
f1c8835d by Dominik Peteler at 2022-08-20T12:28:35+02:00
Removed references to driver from Specialise pass

- - - - -
ab775aa5 by Dominik Peteler at 2022-08-20T12:28:36+02:00
Split `Core.EndPass` from `Core.Lint`

This better sepates concerns (linting is domain layer, end pass
diagnostics is application later), and `Core.Lint` is a huge module to
boot.

- - - - -
fb7959e9 by Dominik Peteler at 2022-08-20T12:28:37+02:00
Get rid of `CoreDesugar`, `CoreDesugarOpt`, `CoreTidy`, `CorePrep`

Those are not Core -> Core passes and so they don't belong in that sum type.

Also cleaned up a bit:

 * Removed 'GHC.Driver.Config.Core.Lint.lintCoreBindings'
   It was dead code.

 * Removed 'GHC.Driver.Config.Core.Lint.lintPassResult'
   It run the actual linting and therefore it didn't belong to the
   GHC.Driver.Config namespace. As it was used only once the definition
   got inlined.

 * GHC.Core.Lint: Renamed lintPassResult' to lintPassResult.
   Also renamed lintCoreBindings' to lintCoreBindings.

 * GHC.Driver.Config.Core.Lint: Stick to the defaults when initializing
   the config records.

 * GHC.Driver.Config.Core.EndPass: Inlined `endPass`

 * GHC.Driver.Config.Core.EndPass: Removed `endPassLintFlags` as it was never used

- - - - -
904da0ad by Dominik Peteler at 2022-08-20T12:28:38+02:00
Simplified initSimplifyOpts

- - - - -
247c5541 by Dominik Peteler at 2022-08-20T12:28:38+02:00
Adjusted tests

- - - - -
6dc702d6 by Dominik Peteler at 2022-08-20T12:28:39+02:00
Removed RuleBase from getCoreToDo

- - - - -
b64653eb by Dominik Peteler at 2022-08-20T12:28:40+02:00
Purified initSpecialiseOpts

Also pass the rule bases and the visible orphan modules as arguments to
the Specialise pass.

- - - - -
7a8d2e4e by Dominik Peteler at 2022-08-20T12:28:41+02:00
Simplified CoreToDo interpreter a bit

- - - - -
dfd74e45 by Dominik Peteler at 2022-08-20T12:33:40+02:00
Config records of some Core passes are now provided by CoreToDo

 * CoreAddCallerCcs
 * CoreAddLateCcs
 * CoreDoFloatInwards
 * CoreLiberateCase
 * CoreDoSpecConstr

- - - - -
2a2b7171 by Dominik Peteler at 2022-08-20T12:33:43+02:00
Move Core pipeline to the driver

 * Moved `getCoreToDo` to an own module GHC.Driver.Config.Core.Opt
 * Moved the remaining part of GHC.Core.Opt.Pipeline to a new module GHC.Driver.Core.Opt
 * Renamed GHC.Core.Opt.Pipeline.Types to GHC.Core.Opt.Config

- - - - -
c3c363b5 by Dominik Peteler at 2022-08-20T12:33:44+02:00
Fixed tests

- - - - -
c6fe37c2 by Dominik Peteler at 2022-08-20T12:33:45+02:00
Fixed note

- - - - -
62e4f342 by John Ericson at 2022-08-20T12:33:46+02:00
Add some haddocks

- - - - -
5017533f by John Ericson at 2022-08-20T12:33:47+02:00
Move `core2core` to `GHC.Driver.Main`

This "pushes up" the planning vs execution split, by not combining the
two until a further downstream module. That helps encourage this
separation we are very much fans of.

Also deduplicate some logic with `liftCoreMToSimplCountM`, which
abstracts over a number of details to eliminate a `CoreM` to a
`SimpleCountM`. It might be a bit too opinionated at the moment, in
which case we will think about how to shuffle some things around.

In addition, deduplicate `simplMask`, which is indeed sketchy thing to
export, but we can deal with that later.

- - - - -
6d7673a2 by John Ericson at 2022-08-20T12:33:47+02:00
Factor out `readRuleEnv` into its own module nad give haddocks

Might end up up recombining this but its good separation of concerns for
now.

- - - - -
109ee718 by John Ericson at 2022-08-20T12:33:48+02:00
Quick and dirty chop up modules once again

I decided my earlier recommendation to mmhat was not quite write. It was
the one I implemented too. So through this together real quick and
dirty. We can make it nicer afterwords

Things that are not yet nice:

 - `CoreOptEnv` is a grab bag of junk. Of course, it is merely reifying
   how was were accessing `HscEnv` before --- also rather junky! So
   maybe it cannot totally be improved. But it would be good to go over
   bits and ask / make issues (like #21926) that would help us clean up
   later.

 - Logging tricks for annotations linting is broken from the planning vs
   execution separation. We'll need to "delay that part of planning too.
   Can hack it up with more higher order function tricks, might be also
   a good oppertunity to rethink what should go in which config.

 - Some of the per-pass config records require info that isn't available
   at planning time. I hacked up up with functions in `CoreToDo` but we
   could do better.

   Conversely, per #21926, perhaps we *should* include the module name
   in the config after all, since we know it from downsweep before
   upsweep begins.

 - `GHC.Driver.Core.Rules` could just go inside `GHC.Driver.Core.Opt`.

- - - - -
c0f7d376 by John Ericson at 2022-08-20T12:33:49+02:00
Split `GHC.Core.Opt.Utils`

Half of it was domain layer (float out switches) but the other half was
infrastructure / driver (annotations).

- - - - -
cff3cbcd by Dominik Peteler at 2022-08-20T12:33:50+02:00
Fixed tests

- - - - -
a2e796c4 by Dominik Peteler at 2022-08-20T12:33:50+02:00
Better configuration of Core lint debug options

- - - - -
97707e4c by Dominik Peteler at 2022-08-20T12:33:51+02:00
Configuration record for rule check pass

- - - - -
89462545 by Dominik Peteler at 2022-08-20T12:33:52+02:00
Renamed dmdAnal to demandAnalysis and moved it to GHC.Core.Opt.DmdAnal

- - - - -
c19f4f85 by Dominik Peteler at 2022-08-20T12:33:53+02:00
Fix tests

- - - - -
554e9f19 by Dominik Peteler at 2022-08-20T12:33:53+02:00
Added environment for worker/wrapper pass

- - - - -
eea78130 by Dominik Peteler at 2022-08-20T12:33:54+02:00
Refactored configuration of Specialise pass again

Also removed GHC.Core.Opt.Specialise.Config again. We may introduce separate
*.Config modules for the passes once we had a look at the module graph
and decide whether the addition of these modules is justified.

- - - - -
e861ca6c by Dominik Peteler at 2022-08-20T12:33:55+02:00
Removed GHC.Driver.Core.Rules

- - - - -
fd350960 by Dominik Peteler at 2022-08-20T12:33:56+02:00
Removed CoreDoNothing and CoreDoPasses

Rewrote the getCoreToDo function using a Writer monad. This makes these
data constructors superfluous.

- - - - -
092fb59f by Dominik Peteler at 2022-08-20T12:33:56+02:00
Renamed endPassIO to endPass

- - - - -
88e1a5e2 by Dominik Peteler at 2022-08-20T12:33:57+02:00
Renamed hscSimplify/hscSimplify' to optimizeCoreIO/optimizeCoreHsc

- - - - -
03b4723f by Dominik Peteler at 2022-08-20T12:33:58+02:00
Run simplifyPgm in SimplCountM

- - - - -
ffd58d02 by Dominik Peteler at 2022-08-20T12:33:59+02:00
Added note on the architecture of the Core optimizer

- - - - -


25 changed files:

- compiler/GHC.hs
- compiler/GHC/Core.hs
- + compiler/GHC/Core/EndPass.hs
- compiler/GHC/Core/LateCC.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Lint/Interactive.hs
- + compiler/GHC/Core/Opt.hs
- compiler/GHC/Core/Opt/CallerCC.hs
- − compiler/GHC/Core/Opt/CallerCC.hs-boot
- + compiler/GHC/Core/Opt/CallerCC/Filter.hs
- compiler/GHC/Core/Opt/Pipeline/Types.hs → compiler/GHC/Core/Opt/Config.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/FloatOut.hs
- + compiler/GHC/Core/Opt/FloatOutSwitches.hs
- − compiler/GHC/Core/Opt/Pipeline.hs
- + compiler/GHC/Core/Opt/RuleCheck.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Monad.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/Opt/Stats.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ffaadeb905fc6fca09ed0aed0b32629804290330...ffd58d021b5c6c0574b5d013365e1500d40a9fbc

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/ffaadeb905fc6fca09ed0aed0b32629804290330...ffd58d021b5c6c0574b5d013365e1500d40a9fbc
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/20220820/62434430/attachment-0001.html>


More information about the ghc-commits mailing list