[Git][ghc/ghc][wip/spj-unf-size] 63 commits: Turn -Wtype-equality-out-of-scope on by default

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Wed Jan 17 17:48:01 UTC 2024



Simon Peyton Jones pushed to branch wip/spj-unf-size at Glasgow Haskell Compiler / GHC


Commits:
eaf8a06d by Krzysztof Gogolewski at 2024-01-11T00:43:17+01:00
Turn -Wtype-equality-out-of-scope on by default

Also remove -Wnoncanonical-{monoid,monad}-instances from -Wcompat,
since they are enabled by default. Refresh wcompat-warnings/ test
with new -Wcompat warnings.

Part of #24267

Co-authored-by: sheaf <sam.derbyshire at gmail.com>

- - - - -
42bee5aa by Sebastian Graf at 2024-01-12T21:16:21-05:00
Arity: Require called *exactly once* for eta exp with -fpedantic-bottoms (#24296)

In #24296, we had a program in which we eta expanded away an error despite the
presence of `-fpedantic-bottoms`.
This was caused by turning called *at least once* lambdas into one-shot lambdas,
while with `-fpedantic-bottoms` it is only sound to eta expand over lambdas that
are called *exactly* once.
An example can be found in `Note [Combining arity type with demand info]`.

Fixes #24296.

- - - - -
7e95f738 by Andreas Klebinger at 2024-01-12T21:16:57-05:00
Aarch64: Enable -mfma by default.

Fixes #24311

- - - - -
e43788d0 by Jason Shipman at 2024-01-14T12:47:38-05:00
Add more instances for Compose: Fractional, RealFrac, Floating, RealFloat

CLC proposal #226 https://github.com/haskell/core-libraries-committee/issues/226

- - - - -
ae6d8cd2 by Sebastian Graf at 2024-01-14T12:48:15-05:00
Pmc: COMPLETE pragmas associated with Family TyCons should apply to representation TyCons as well (#24326)

Fixes #24326.

- - - - -
c5fc7304 by sheaf at 2024-01-15T14:15:29-05:00
Use lookupOccRn_maybe in TH.lookupName

When looking up a value, we want to be able to find both variables
and record fields. So we should not use the lookupSameOccRn_maybe
function, as we can't know ahead of time which record field namespace
a record field with the given textual name will belong to.

Fixes #24293

- - - - -
da908790 by Krzysztof Gogolewski at 2024-01-15T14:16:05-05:00
Make the build more strict on documentation errors

* Detect undefined labels. This can be tested by adding :ref:`nonexistent`
  to a documentation rst file; attempting to build docs will fail.
  Fixed the undefined label in `9.8.1-notes.rst`.
* Detect errors. While we have plenty of warnings, we can at least enforce
  that Sphinx does not report errors.
  Fixed the error in `required_type_arguments.rst`.

Unrelated change: I have documented that the `-dlint` enables
`-fcatch-nonexhaustive-cases`, as can be verified by checking
`enableDLint`.

- - - - -
5077416e by Javier Sagredo at 2024-01-16T15:40:06-05:00
Profiling: Adds an option to not start time profiling at startup

Using the functionality provided by
d89deeba47ce04a5198a71fa4cbc203fe2c90794, this patch creates a new rts
flag `--no-automatic-time-samples` which disables the time profiling
when starting a program. It is then expected that the user starts it
whenever it is needed.

Fixes #24337

- - - - -
5776008c by Matthew Pickering at 2024-01-16T15:40:42-05:00
eventlog: Fix off-by-one error in postIPE

We were missing the extra_comma from the calculation of the size of the
payload of postIPE. This was causing assertion failures when the event
would overflow the buffer by one byte, as ensureRoomForVariable event
would report there was enough space for `n` bytes but then we would
write `n + 1` bytes into the buffer.

Fixes #24287

- - - - -
66dc09b1 by Simon Peyton Jones at 2024-01-16T15:41:18-05:00
Improve SpecConstr (esp nofib/spectral/ansi)

This MR makes three improvements to SpecConstr: see #24282

* It fixes an outright (and recently-introduced) bug in `betterPat`, which
  was wrongly forgetting to compare the lengths of the argument lists.

* It enhances ConVal to inclue a boolean for work-free-ness, so that the
  envt can contain non-work-free constructor applications, so that we
  can do more: see Note [ConVal work-free-ness]

* It rejigs `subsumePats` so that it doesn't reverse the list.  This can
  make a difference because, when patterns overlap, we arbitrarily pick
  the first.  There is no "right" way, but this retains the old
  pre-subsumePats behaviour, thereby "fixing" the regression in #24282.

Nofib results

   +========================================
   |                 spectral/ansi  -21.14%
   | spectral/hartel/comp_lab_zift   -0.12%
   |       spectral/hartel/parstof   +0.09%
   |           spectral/last-piece   -2.32%
   |           spectral/multiplier   +6.03%
   |                 spectral/para   +0.60%
   |               spectral/simple   -0.26%
   +========================================
   |                     geom mean   -0.18%
   +----------------------------------------

The regression in `multiplier` is sad, but it simply replicates GHC's
previous behaviour (e.g. GHC 9.6).

- - - - -
65da79b3 by Matthew Pickering at 2024-01-16T15:41:54-05:00
hadrian: Reduce Cabal verbosity

The comment claims that `simpleUserHooks` decrease verbosity, and it
does, but only for the `postConf` phase. The other phases are too
verbose with `-V`.

At the moment > 5000 lines of the build log are devoted to output from
`cabal copy`.

So I take the simple approach and just decrease the verbosity level
again.

If the output of `postConf` is essential then it would be better to
implement our own `UserHooks` which doesn't decrease the verbosity for
`postConf`.

Fixes #24338

- - - - -
16414d7d by Matthew Pickering at 2024-01-17T10:54:59-05:00
Stop retaining old ModGuts throughout subsequent simplifier phases

Each phase of the simplifier typically rewrites the majority of ModGuts,
so we want to be able to release the old ModGuts as soon as possible.

`name_ppr_ctxt` lives throught the whole optimiser phase and it was
retaining a reference to `ModGuts`, so we were failing to release the
old `ModGuts` until the end of the phase (potentially doubling peak
memory usage for that particular phase).

This was discovered using eras profiling (#24332)

Fixes #24328

- - - - -
7f0879e1 by Matthew Pickering at 2024-01-17T10:55:35-05:00
Update nofib submodule

- - - - -
d27415f2 by Simon Peyton Jones at 2024-01-17T17:47:38+00:00
Work in progress on unfoldings re-engineering

- - - - -
8669158b by Simon Peyton Jones at 2024-01-17T17:47:38+00:00
More

- - - - -
44e4887a by Simon Peyton Jones at 2024-01-17T17:47:38+00:00
More -- now it compiles

- - - - -
8b91af79 by Simon Peyton Jones at 2024-01-17T17:47:38+00:00
Wibbles

- - - - -
23cf1234 by Simon Peyton Jones at 2024-01-17T17:47:38+00:00
Wibbles

- - - - -
1a362c65 by Simon Peyton Jones at 2024-01-17T17:47:38+00:00
Wibbles

- - - - -
24334d68 by Simon Peyton Jones at 2024-01-17T17:47:38+00:00
More wibbles

In particular, respect OtherCon

- - - - -
7004cff0 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
oops remove spurious trace

- - - - -
1b93c4ce by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Value args only in ExprTrees

- - - - -
c55ec412 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Another wibble

- - - - -
0f7243a9 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Be a little bit more eager

- - - - -
29d68916 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Comment out unused arg_is_free

- - - - -
c8e4b0df by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Fix scoping bug

- - - - -
8fece5f7 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Take care with void args

- - - - -
d25ab6cc by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Comments

- - - - -
bfc6124d by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Limit case width and depth

- - - - -
664702d0 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
White space

- - - - -
b7f3cb45 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Simplify size calculations

- - - - -
3238158a by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Fix egregious error

- - - - -
edf326ca by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Further improvements

* Fix threshold in SpecConstr
* Need to recurse in keptCaseSize

- - - - -
6d70a151 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
More care with discounts and sizes

- - - - -
b7357304 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
More improvements

Rename et_tot to et_wc_tot (for "worst case")

Fix size bug in etCaseOf

- - - - -
52f9bd75 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Bale out altogether on very wide cases

- - - - -
910ffde3 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Stupid typo

- - - - -
f7294bc8 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Wibble

- - - - -
90c3eee6 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
More improvements

Mainly doing the result-discounts as before.

Some skirmishing about dealing with knownCon.. more to come

- - - - -
9f3429f1 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Fix a bad, subtle bug in exprIsConApp_maybe

In extend_in_scope We were simply overwriting useful bindings in the
in-scope set, notably ones that had unfoldings.  That could lead to
repeated simplifier iterations.

- - - - -
24e80d02 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Minor refactoring...

Plus: don't be so eager to inline when argument is a non-value,
but has some struture.

We want *some* incentive though.

- - - - -
4c9a5a34 by Simon Peyton Jones at 2024-01-17T17:47:39+00:00
Wibbles

The significant one is a discount for arguments that have structure

- - - - -
dde94bf7 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
More wibbles

- - - - -
0c0183e6 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Small updates

* Reduce unfolding-use-threshold to 80
* Make dfun applications look like value args

- - - - -
d28581fc by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Inline on structured arguments

- - - - -
2a089b39 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Further wibbles

Make unlifted cases cheaper

- - - - -
eb3952e5 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Wibbles

- - - - -
8cbef800 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Adjust thresholds

- - - - -
7e6f2f52 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
More small changes

* Result discounts like before -- on RhsCtxt
* Increase funAppDiscount and caseElimDiscount a bit

- - - - -
535e4b4a by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Add RULES for eqList on []

This gives us better code when you say
   xs = []  or    xs /= []

- - - - -
8b1c0f21 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Adjust default thresholds slightly

- - - - -
e72619a5 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Adjust back

- - - - -
1cd3eaa7 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Better eqString/eqList stuff

- - - - -
95451e35 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Adjust

* Reduce caseElimDiscount to 10
  Example: f_nand in spectral/hartel/event is quite big but was still
     getting inlined; that make f_simulate too big for SpecConstr

* Increase jumpSize. Not so much cheaper than tail calls.
  I'm trying making them the same size.

- - - - -
7e894ce0 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
More adjustments

* Revert un-force jumpSize change
* Try making lambdas free

- - - - -
0492632a by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Wibbles

- - - - -
00f06977 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Make calls cheap, but charge for closures

This is a fairly significant change.

- - - - -
d307b758 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Specialise Data.List.lookup on Int and Char

- - - - -
a205b660 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Fix four bug in handling of (forall cv. body_ty)

These bugs are all described in #24335

It's not easy to provoke the bug, hence no test case.

- - - - -
18423109 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Add NOINLINE for eqList

eqList is already recursie, and so won't inline, but I was getting
warnings about the rewrite rule involving eqList, so the easiest
thing is to just mark it NOINLINE.

- - - - -
7cc2f70f by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Wibbles

- - - - -
71e6ec0c by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Be consistent about call sizes

- - - - -
28b0e8c1 by Simon Peyton Jones at 2024-01-17T17:47:40+00:00
Wibbles to respond to reviews

- - - - -


20 changed files:

- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/LiberateCase.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Inline.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Ppr.hs
- compiler/GHC/Core/Rules.hs
- compiler/GHC/Core/Seq.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/Subst.hs
- compiler/GHC/Core/Tidy.hs
- compiler/GHC/Core/Type.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fa3fd7122c76e884a700511c971a9160957b75f8...28b0e8c1d68f502a3a8db0c4fb4ea2710527ebb0

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/fa3fd7122c76e884a700511c971a9160957b75f8...28b0e8c1d68f502a3a8db0c4fb4ea2710527ebb0
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/20240117/38f10158/attachment-0001.html>


More information about the ghc-commits mailing list