[Git][ghc/ghc][wip/simplifier-tweaks] 15 commits: Deprecate -Wsemigroup
Simon Peyton Jones (@simonpj)
gitlab at gitlab.haskell.org
Thu Jan 11 16:45:22 UTC 2024
Simon Peyton Jones pushed to branch wip/simplifier-tweaks at Glasgow Haskell Compiler / GHC
Commits:
e3ca78f3 by Krzysztof Gogolewski at 2024-01-10T17:35:59-05:00
Deprecate -Wsemigroup
This warning was used to prepare for Semigroup becoming a superclass
of Monoid, and for (<>) being exported from Prelude. This happened in
GHC 8.4 in 8ae263ceb3566 and feac0a3bc69fd3.
The leftover logic for (<>) has been removed in GHC 9.8, 4d29ecdfcc79.
Now the warning does nothing at all and can be deprecated.
- - - - -
08d14925 by amesgen at 2024-01-10T17:36:42-05:00
WASM metadata: use correct GHC version
- - - - -
7a808419 by Xiaoyan Ren at 2024-01-10T17:37:24-05:00
Allow SCC declarations in TH (#24081)
- - - - -
28827c51 by Xiaoyan Ren at 2024-01-10T17:37:24-05:00
Fix prettyprinting of SCC pragmas
- - - - -
ae9cc1a8 by Matthew Craven at 2024-01-10T17:38:01-05:00
Fix loopification in the presence of void arguments
This also removes Note [Void arguments in self-recursive tail calls],
which was just misleading. It's important to count void args both
in the function's arity and at the call site.
Fixes #24295.
- - - - -
b718b145 by Zubin Duggal at 2024-01-10T17:38:36-05:00
testsuite: Teach testsuite driver about c++ sources
- - - - -
09cb57ad by Zubin Duggal at 2024-01-10T17:38:36-05:00
driver: Set -DPROFILING when compiling C++ sources with profiling
Earlier, we used to pass all preprocessor flags to the c++ compiler.
This meant that -DPROFILING was passed to the c++ compiler because
it was a part of C++ flags
However, this was incorrect and the behaviour was changed in
8ff3134ed4aa323b0199ad683f72165e51a59ab6. See #21291.
But that commit exposed this bug where -DPROFILING was no longer being passed
when compiling c++ sources.
The fix is to explicitly include -DPROFILING in `opt_cxx` when profiling is
enabled to ensure we pass the correct options for the way to both C and C++
compilers
Fixes #24286
- - - - -
2cf9dd96 by Zubin Duggal at 2024-01-10T17:38:36-05:00
testsuite: rename objcpp -> objcxx
To avoid confusion with C Pre Processsor
- - - - -
af6932d6 by Simon Peyton Jones at 2024-01-10T17:39:12-05:00
Make TYPE and CONSTRAINT not-apart
Issue #24279 showed up a bug in the logic in GHC.Core.Unify.unify_ty
which is supposed to make TYPE and CONSTRAINT be not-apart.
Easily fixed.
- - - - -
4a39b5ff by Zubin Duggal at 2024-01-10T17:39:48-05:00
ci: Fix typo in mk_ghcup_metadata.py
There was a missing colon in the fix to #24268 in 989bf8e53c08eb22de716901b914b3607bc8dd08
- - - - -
13503451 by Zubin Duggal at 2024-01-10T17:40:24-05:00
release-ci: remove release-x86_64-linux-deb11-release+boot_nonmoving_gc job
There is no reason to have this release build or distribute this variation.
This configuration is for testing purposes only.
- - - - -
afca46a4 by Sebastian Graf at 2024-01-10T17:41:00-05:00
Parser: Add a Note detailing why we need happy's `error` to implement layout
- - - - -
18f1875c by Simon Peyton Jones at 2024-01-11T16:34:31+00:00
Several improvements to the handling of coercions
* Make `mkSymCo` and `mkInstCo` smarter
Fixes #23642
* Fix return role of `SelCo` in the coercion optimiser.
Fixes #23617
* Make the coercion optimiser `opt_trans_rule` work better for newtypes
Fixes #23619
- - - - -
359d2a82 by Simon Peyton Jones at 2024-01-11T16:43:46+00:00
Simplifier improvements
This MR started as: allow the simplifer to do more in one pass,
arising from places I could see the simplifier taking two iterations
where one would do. But it turned into a larger project, because
these changes unexpectedly made inlining blow up, especially join
points in deeply-nested cases.
The net result is good: a 1.5% improvement in compile time. The table
below shows changes over 1%.
The main changes are:
* The SimplEnv now has a seInlineDepth field, which says how deep
in unfoldings we are. See Note [Inline depth] in Simplify.Env
* Avoid repeatedly simplifying coercions.
see Note [Avoid re-simplifying coercions] in Simplify.Iteration
As you'll see from the Note, this makes use of the seInlineDepth.
* Allow Simplify.Utils.postInlineUnconditionally to inline variables
that are used exactly once. See Note [Post-inline for single-use things].
* Allow Simplify.Iteration.simplAuxBind to inline used-once things.
This is another part of Note [Post-inline for single-use things], and
is really good for reducing simplifier iterations in situations like
case K e of { K x -> blah }
wher x is used once in blah.
* Make GHC.Core.SimpleOpt.exprIsConApp_maybe do some simple case
elimination. Note [Case elim in exprIsConApp_maybe]
* Many new or rewritten Notes. E.g. Note [Avoiding simplifying repeatedly]
Join points
~~~~~~~~~~~
* Be very careful about inlining join points. See
Note [Duplicating join points] in GHC.Core.Opt.Simplify.Iteration
* When making join points, don't do so if the join point is so small
it will immediately be inlined; check uncondInlineJoin.
* When considering inlining a join point, never do so unless
there is a positive gain: see (DJ5) in Note [Duplicating join points].
* Do not float join points at all, except to top level.
See GHC.Core.Opt.SetLevels.dontFloatNonRec
* Do not add an unfolding to a join point at birth. This is a tricky one
and has a long Note [Do not add unfoldings to join points at birth]
It shows up in two places
- In `mkDupableAlt` do not add an inlining
- (trickier) In `simplLetUnfolding` don't add an unfolding for a
fresh join point
I am not fully satisifed with this, but it works and is well documented.
* In GHC.Core.Unfold.sizeExpr, make jumps small, so that we don't penalise
having a non-inlined join point.
* Use plan A for dataToTag and tagToEnum
I discovered that GHC.HsToCore.Pmc.Solver.Types.trvVarInfo was very
delicately balanced. It's a small, heavily used, overloaded function
and it's important that it inlines. By a fluke it was before, but at
various times in my journey it stopped doing so. So I added an INLINE
pragma to it.
Metrics: compile_time/bytes allocated
------------------------------------------------
CoOpt_Singletons(normal) -8.2% GOOD
LargeRecord(normal) -22.7% GOOD
PmSeriesS(normal) -4.1%
PmSeriesT(normal) -3.1%
PmSeriesV(normal) -1.6%
T11195(normal) -1.9%
T12227(normal) -19.9% GOOD
T12545(normal) -5.4%
T12707(normal) -2.1% GOOD
T13253-spj(normal) -13.1% GOOD
T13386(normal) -1.6%
T14766(normal) -2.2% GOOD
T15630a(normal) NEW
T15703(normal) -13.5% GOOD
T16577(normal) -4.3% GOOD
T17096(normal) -4.4%
T17516(normal) -0.2%
T18223(normal) -16.3% GOOD
T18282(normal) -5.3% GOOD
T18730(optasm) NEW
T18923(normal) -3.7% GOOD
T21839c(normal) -2.3% GOOD
T3064(normal) -1.3%
T5030(normal) -16.1% GOOD
T5321Fun(normal) -1.5%
T6048(optasm) -11.8% GOOD
T783(normal) -1.4%
T8095(normal) -5.9% GOOD
T9630(normal) -5.1% GOOD
T9020(optasm) +1.5%
T18698a(normal) +1.5% BAD
T14683(normal) +1.2%
DsIncompleteRecSel3(normal) +1.2%
MultiComponentModulesRecomp(normal) +1.0%
MultiLayerModulesRecomp(normal) +1.9%
MultiLayerModulesTH_Make(normal) +1.4%
T10421(normal) +1.9% BAD
T10421a(normal) +3.0%
T13056(optasm) +1.1%
T13253(normal) +1.0%
T1969(normal) +1.1% BAD
T15304(normal) +1.7%
T9675(optasm) +1.2%
T9961(normal) +2.4% BAD
geo. mean -1.5%
minimum -22.7%
maximum +3.0%
Metric Decrease:
CoOpt_Singletons
LargeRecord
T12227
T12707
T12990
T13253-spj
T13536a
T14766
T15703
T16577
T18223
T18282
T18923
T21839c
T5030
T6048
T8095
T9630
Metric Increase:
T10421
T18698a
T1969
T9961
- - - - -
ef3db00a by Simon Peyton Jones at 2024-01-11T16:44:26+00:00
Improve postInlineUnconditionally
This commit adds two things to postInlineUnconditionally:
1. Do not postInlineUnconditionally join point, ever.
Doing so does not reduce allocation, which is the main point,
and with join points that are used a lot it can bloat code.
See point (1) of Note [Duplicating join points] in
GHC.Core.Opt.Simplify.Iteration.
2. Do not postInlineUnconditionally a strict (demanded) binding.
It will not allocate a thunk (it'll turn into a case instead)
so again the main point of inlining it doesn't hold. Better
to check per-call-site.
- - - - -
30 changed files:
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- compiler/GHC/Builtin/Names/TH.hs
- compiler/GHC/CmmToAsm/Wasm/Asm.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/SetLevels.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/Monad.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/Stats.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/Unfold.hs
- compiler/GHC/Core/Unfold/Make.hs
- compiler/GHC/Core/Unify.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/HsToCore/Pmc/Solver/Types.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/Parser.y
- compiler/GHC/Platform/Ways.hs
- compiler/GHC/StgToCmm/Bind.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e0bfe2940f5dfc080acdd13713f45ac95879e96c...ef3db00a55ceac61b45aa3bd0fc4b256935020e3
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/e0bfe2940f5dfc080acdd13713f45ac95879e96c...ef3db00a55ceac61b45aa3bd0fc4b256935020e3
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/20240111/865b49ea/attachment-0001.html>
More information about the ghc-commits
mailing list