[Git][ghc/ghc][wip/buildplan] 34 commits: EPA: reduce [AddEpann] in AnnList
Cheng Shao (@TerrorJack)
gitlab at gitlab.haskell.org
Sun Nov 3 13:59:41 UTC 2024
Cheng Shao pushed to branch wip/buildplan at Glasgow Haskell Compiler / GHC
Commits:
7b1b0c6d by Alan Zimmerman at 2024-10-24T13:07:02-04:00
EPA: reduce [AddEpann] in AnnList
Remove it from the `al_rest` field, and make `AnnList` parameterized
on a type to be used in `al_rest`, for the various use cases.
- - - - -
4a00731e by Rodrigo Mesquita at 2024-10-24T13:07:38-04:00
Fix -fobject-determinism flag definition
The flag should be defined as an fflag to make sure the
-fno-object-determinism flag is also an available option.
Fixes #25397
- - - - -
55e4b9f2 by Sebastian Graf at 2024-10-25T07:01:54-04:00
CorePrep: Attach evaldUnfolding to floats to detect more values
See `Note [Pin evaluatedness on floats]`.
- - - - -
9f57c96d by Sebastian Graf at 2024-10-25T07:01:54-04:00
Make DataCon workers strict in strict fields (#20749)
This patch tweaks `exprIsConApp_maybe`, `exprIsHNF` and friends, and Demand
Analysis so that they exploit and maintain strictness of DataCon workers. See
`Note [Strict fields in Core]` for details.
Very little needed to change, and it puts field seq insertion done by Tag
Inference into a new perspective: That of *implementing* strict field semantics.
Before Tag Inference, DataCon workers are strict. Afterwards they are
effectively lazy and field seqs happen around use sites. History has shown
that there is no other way to guarantee taggedness and thus the STG Strict Field
Invariant.
Knock-on changes:
* I reworked the whole narrative around "Tag inference".
It's now called "EPT enforcement" and I recycyled the different overview
Notes into `Note [EPT enforcement]`.
* `exprIsHNF` previously used `exprOkForSpeculation` on unlifted arguments
instead of recursing into `exprIsHNF`. That regressed the termination
analysis in CPR analysis (which simply calls out to `exprIsHNF`), so I made
it call `exprOkForSpeculation`, too.
* There's a small regression in Demand Analysis, visible in the changed test
output of T16859: Previously, a field seq on a variable would give that
variable a "used exactly once" demand, now it's "used at least once",
because `dmdTransformDataConSig` accounts for future uses of the field
that actually all go through the case binder (and hence won't re-enter the
potential thunk). The difference should hardly be observable.
* The Simplifier's fast path for data constructors only applies to lazy
data constructors now. I observed regressions involving Data.Binary.Put's
`Pair` data type.
* Unfortunately, T21392 does no longer reproduce after this patch, so I marked
it as "not broken" in order to track whether we regress again in the future.
Fixes #20749, the satisfying conclusion of an annoying saga (cf. the ideas
in #21497 and #22475).
Compiler perf generally improves, sometimes drastically:
Baseline
Test Metric value New value Change
--------------------------------------------------------------------------------
ManyConstructors(normal) ghc/alloc 3,629,760,116 3,711,852,800 +2.3% BAD
MultiLayerModulesTH_OneShot(normal) ghc/alloc 2,502,735,440 2,565,282,888 +2.5% BAD
T12707(normal) ghc/alloc 804,399,798 791,807,320 -1.6% GOOD
T17516(normal) ghc/alloc 964,987,744 1,008,383,520 +4.5%
T18140(normal) ghc/alloc 75,381,152 49,860,560 -33.9% GOOD
T18698b(normal) ghc/alloc 232,614,457 184,262,736 -20.8% GOOD
T18923(normal) ghc/alloc 62,002,368 58,301,408 -6.0% GOOD
T20049(normal) ghc/alloc 75,719,168 70,494,368 -6.9% GOOD
T3294(normal) ghc/alloc 1,237,925,833 1,157,638,992 -6.5% GOOD
T9233(normal) ghc/alloc 686,490,105 635,166,688 -7.5% GOOD
geo. mean -0.7%
minimum -33.9%
maximum +4.5%
I looked at T17516. It seems we do a few more simplifier iterations and end up
with a larger program. It seems that some things inline more, while other things
inline less. I don't see low-hanging fruit.
I also looked at MultiLayerModulesTH_OneShot. It appears we generate a strange
join point in the `getUnique` method of `Uniquable GHC.Unit.Types.Module` that
should better call-site inline, but does not. Perhaps with !11492.
NoFib does not seem affected much either:
+-------------------------------++--+------------+-----------+---------------+-----------+
| || | base/ | std. err. | T20749/ (rel) | std. err. |
+===============================++==+============+===========+===============+===========+
| spectral/last-piece || | 7.263e8 | 0.0% | +0.62% | 0.0% |
+===============================++==+============+===========+===============+===========+
| geom mean || | +0.00% | | | |
+-------------------------------++--+------------+-----------+---------------+-----------+
I had a look at last-piece. Nothing changes in stg-final, but there is a bit
of ... movement around Data.Map.insert's use of GHC.Exts.lazy that is gone in
stg-final.
Co-Authored-By: Jaro Reinders <jaro.reinders at gmail.com>
Metric Decrease:
T12707
T18140
T18698b
T18923
T19695
T20049
T3294
T9233
T21839c
Metric Increase:
ManyConstructors
MultiLayerModulesTH_OneShot
- - - - -
0225249a by Simon Peyton Jones at 2024-10-25T07:02:32-04:00
Some renaming
This is a pure refactor, tidying up some inconsistent naming:
isEqPred --> isEqClassPred
isEqPrimPred --> isEqPred
isReprEqPrimPred --> isReprEqPred
mkPrimEqPred --> mkNomEqPred
mkReprPrimEqPred --> mkReprEqPred
mkPrimEqPredRold --> mkEqPredRole
Plus I moved mkNomEqPred, mkReprEqPred, mkEqPredRolek
from GHC.Core.Coercion to GHC.Core.Predicate
where they belong. That means that Coercion imports Predicate
rather than vice versa -- better.
- - - - -
15a3456b by Ryan Hendrickson at 2024-10-25T07:02:32-04:00
compiler: Fix deriving with method constraints
See Note [Inferred contexts from method constraints]
Co-authored-by: Simon Peyton Jones <simon.peytonjones at gmail.com>
- - - - -
dbc77ce8 by Alan Zimmerman at 2024-10-25T18:20:13+01:00
EPA: Remove AddEpann commit 7
EPA: Remove [AddEpAnn] from HYPHEN in Parser.y
The return value is never used, as it is part of the backpack
configuration parsing.
EPA: Remove last [AddEpAnn] usages
Remove residual usage in GHC. It is still used
- In haddock TTG extension point definitions (to be removed)
- Some check-exact residual, to be removed
- Comments around DisambECP in PostProcess
EPA: Clean up [AddEpAnn] from check-exact
There is one left, to be cleaned up when we remove AddEpann itself
EPA: Remove [AddEpAnn] from haddock
The TTG extension points need a value, it is not critical what that
value is, in most cases.
EPA: Remove AddEpAnn from HsRuleAnn
EPA: Remove AddEpAnn from HsCmdArrApp
- - - - -
23ddcc01 by Simon Peyton Jones at 2024-10-26T12:44:34-04:00
Fix optimisation of InstCo
It turned out (#25387) that the fix to #15725 was not quite right:
commit 48efbc04bd45d806c52376641e1a7ed7278d1ec7
Date: Mon Oct 15 10:25:02 2018 +0200
Fix #15725 with an extra Sym
Optimising InstCo is quite subtle, and the invariants surrounding
the LiftingContext in the coercion optimiser were not stated explicitly.
This patch refactors the InstCo optimisation, and documents these
invariants. See
* Note [Optimising InstCo]
* Note [The LiftingContext in optCoercion]
I also did some refactoring of course:
* Instead of a Bool swap-flag, I am not using GHC.Types.Basic.SwapFlag
* I added some invariant-checking the coercion-construction functions
in GHC.Core.Coercion.Opt. (Sadly these invariants don't hold during
typechecking, becuase the types are un-zonked, so I can't put these
checks in GHC.Core.Coercion.)
- - - - -
589fea7f by Cheng Shao at 2024-10-27T05:36:38-04:00
ghcid: use multi repl for ghcid
- - - - -
d52a0475 by Andrew Lelechenko at 2024-10-27T05:37:13-04:00
documentation: add motivating section to Control.Monad.Fix
- - - - -
301c3b54 by Cheng Shao at 2024-10-27T05:37:49-04:00
wasm: fix safari console error message related to import("node:timers")
This patch fixes the wasm backend JSFFI prelude script to avoid
calling `import("node:timers")` on non-deno hosts. Safari doesn't like
it and would print an error message to the console. Fixes
https://gitlab.haskell.org/ghc/ghc-wasm-meta/-/issues/13.
- - - - -
9f02dfb5 by Simon Peyton Jones at 2024-10-27T15:10:08-04:00
Add a missing tidy in UnivCo
We were failing to tidy the argument coercions of a UnivCo, which
led directly to #25391.
The fix is, happily, trivial.
I don't have a small repro case (it came up when building horde-ad,
which uses typechecker plugins). It should be possible to make a
repro case, by using a plugin (which builds a UnivCo) but I decided
it was not worth the bother. The bug is egregious and easily fixed.
- - - - -
853050c3 by Andrew Lelechenko at 2024-10-27T15:10:44-04:00
Bump text submodule to 2.1.2
- - - - -
90746a59 by Andrew Lelechenko at 2024-10-27T15:10:44-04:00
hadrian: allow -Wunused-imports for text package
- - - - -
8a6691c3 by Alan Zimmerman at 2024-10-27T19:44:48+00:00
EPA: Remove AddEpAnn Commit 8/final
EPA: Remove AddEpAnn from AnnList
EPA: Remove AddEpAnn from GrhsAnn
This is the last actual use
EPA: Remove NameAdornment from NameAnn
Also rework AnnContext to use EpToken, and AnnParen
EPA: Remove AddEpAnn. Final removal
There are now none left, except for in a large note/comment in
PostProcess, describing the historical transition to the
disambiguation infrastructure
- - - - -
d5e7990c by Alan Zimmerman at 2024-10-28T21:41:05+00:00
EPA: Remove AnnKeywordId.
This was used as part of AddEpAnn, and is no longer needed.
Also remove all the haddock comments about which of are attached to
the various parts of the AST. This is now clearly captured in the
appropriate TTG extension points, and the `ExactPrint.hs` file.
- - - - -
e08b8370 by Serge S. Gulin at 2024-10-29T23:17:01-04:00
JS: Re-add optimization for literal strings in genApp (fixes #23479)
Based on https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10588/
Co-authored-by: Sylvain Henry <sylvain at haskus.fr>
Co-authored-by: Andrei Borzenkov <root at sandwitch.dev>
Co-authored-by: Danil Berestov <goosedb at yandex.ru>
-------------------------
Metric Decrease:
T25046_perf_size_gzip
size_hello_artifact
size_hello_artifact_gzip
size_hello_unicode
size_hello_unicode_gzip
-------------------------
- - - - -
e3496ef6 by Cheng Shao at 2024-10-29T23:17:37-04:00
compiler: remove unused hscDecls/hscDeclsWithLocation
This patch removes unused `hscDecls`/`hscDeclsWithLocation` functions
from the compiler, to reduce maintenance burden when doing
refactorings related to ghci.
- - - - -
b1eed26f by Cheng Shao at 2024-10-29T23:18:13-04:00
testsuite: add T25414 test case marked as broken
This commit adds T25414 test case to demonstrate #25414. It is marked
as broken and will be fixed by the next commit.
- - - - -
e70009bc by Cheng Shao at 2024-10-29T23:18:13-04:00
driver: fix foreign stub handling logic in hscParsedDecls
This patch fixes foreign stub handling logic in `hscParsedDecls`.
Previously foreign stubs were simply ignored here, so any feature that
involve foreign stubs would not work in ghci (e.g. CApiFFI). The patch
reuses `generateByteCode` logic and eliminates a large chunk of
duplicate logic that implements Core to bytecode generation pipeline
here. Fixes #25414.
- - - - -
1d7cd7fe by Andreas Klebinger at 2024-10-30T19:14:28-04:00
Add since tag for -fwrite-if-compression in user guide.
Partial fix for #25395
- - - - -
b349fd1b by Alan Zimmerman at 2024-10-30T19:15:04-04:00
EPA: Remove some unused functions
- - - - -
f859d61c by Alan Zimmerman at 2024-10-30T19:15:04-04:00
EPA: use explicit vertical bar token for ExplicitSum / SumPat
- - - - -
721ac00d by Ben Gamari at 2024-10-31T08:37:38-04:00
rts/Disassembler: Fix encoding of BRK_FUN instruction
The offset of the CC field was not updated after the encoding change in
b85b11994e0130ff2401dd4bbdf52330e0bcf776. Fix this.
Fixes #25374.
- - - - -
0bc94360 by Alan Zimmerman at 2024-10-31T08:38:15-04:00
EPA: Bring in last EpToken usages
For import declarations, NameAnnCommas and NPlusKPat.
And remove anchor, it is the same as epaLocationRealSrcSpan.
- - - - -
0b11cdc0 by sheaf at 2024-10-31T08:38:55-04:00
Assert that ctEvCoercion is called on an equality
Calling 'ctEvCoercion' on non-equality constraints is always incorrect.
We add an assertion to this function to detect such cases; for example
a type-checking plugin might erroneously do this.
- - - - -
ea458779 by doyougnu at 2024-11-01T18:11:33-04:00
ghc-internal: strict, unboxed src loc ranges
- closes: #20449
- See CLC proposal: #55
- - - - -
778ac793 by Kazuki Okamoto at 2024-11-01T18:12:13-04:00
No haddock markup in doctest line
- - - - -
cf0deeaf by Andreas Klebinger at 2024-11-02T17:54:52-04:00
Reword -fexpose-overloaded-unfoldings docs.
This should make them slightly clearer. Fixes #24844
Co-authored-by: Sylvain Henry <sylvain at haskus.fr>
- - - - -
1c21e7d4 by Andreas Klebinger at 2024-11-02T17:55:29-04:00
Compile T25062 simd tests even if we can't run them.
Helps avoid them being utterly broken.
Fixes #25341
- - - - -
573cad4b by Cheng Shao at 2024-11-02T17:56:04-04:00
Remove unused USE_REPORT_PRELUDE code paths from the tree
This patch removes unused `USE_REPORT_PRELUDE` code paths from the
tree. They have been present since the first git revision
4fb94ae5e5d632748fa2e6c35e259eccc5a1a3f4, and might have been useful
for debugging purposes many years ago, but these code paths are never
actually built. Removing these ease maintenance of relevant modules in
the future, and also allows us to get rid of `CPP` extension in those
modules as a nice byproduct.
- - - - -
70710690 by Cheng Shao at 2024-11-03T14:08:15+01:00
driver: make UsageFile distinguish hs/nonhs deps
- - - - -
b528e54f by Cheng Shao at 2024-11-03T14:54:17+01:00
driver: implement --buildplan major mode to extract BuildPlan info from dependency analysis
- - - - -
cdd379fb by Cheng Shao at 2024-11-03T14:54:22+01:00
track non-hs deps
- - - - -
30 changed files:
- .ghcid
- compiler/GHC.hs
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Builtin/Types/Prim.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Class.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion.hs-boot
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/DataCon.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/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Predicate.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCo/Tidy.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Hs.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8052b03196c1746762d77c296f215cffa9d659a1...cdd379fb5c93740ed91727b7fc0890dd26a769ea
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8052b03196c1746762d77c296f215cffa9d659a1...cdd379fb5c93740ed91727b7fc0890dd26a769ea
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/20241103/7c779214/attachment-0001.html>
More information about the ghc-commits
mailing list