[Git][ghc/ghc][wip/spj-try-opt-coercion] 9 commits: Use "grimily" instead of "grimly"
Simon Peyton Jones pushed to branch wip/spj-try-opt-coercion at Glasgow Haskell Compiler / GHC Commits: 6f9d7c71 by Markus Läll at 2026-05-21T15:25:34-04:00 Use "grimily" instead of "grimly" Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/27221 - - - - - 50e999ca by fendor at 2026-05-21T15:26:18-04:00 Speed up 'closure' computation in `ghc-pkg` Cache the set of already seen `UnitId`s and use `Set` operations to speed up 'closure' computation. Further simplify the implementation of 'closure' to account for the actual usage. As a consequence, we rename 'closure' to 'brokenPackages' to reflect its purpose better after the simplification. - - - - - 7ecc6184 by sheaf at 2026-05-21T15:27:10-04:00 TcMPluginHandling: be more lenient when no plugins This change ensures that, if a function such as 'typecheckModule' was invoked with 'NoTcMPlugins', GHC doesn't spuriously complain about TcM plugins having already been stopped, as there were none to start with. - - - - - 72c8de5c by Simon Jakobi at 2026-05-23T18:41:42-04:00 Implement List.elem via foldr ...in order to allow specialization to Eq instances. The implementation of notElem is updated for consistency.` Corresponding CLC proposal: https://github.com/haskell/core-libraries-committee/issues/412 Addresses #27096. - - - - - 3268c610 by Alan Zimmerman at 2026-05-23T18:42:30-04:00 EPA: Fix span for qualified multiline string Fix the span for a qualified multiline string like Text.""" I'm a multiline Text value ! """ to extend to the end of the entire string, not just the first line. Closes #27274 - - - - - 1f096790 by Alan Zimmerman at 2026-05-23T18:43:20-04:00 EPA: Fix exact printing namespace-specified wildcards Ensures correct printing of imports of the form import Data.Bool (data True(data ..)) import Data.Bool (data True(type ..)) Closes #27291 - - - - - 56ada7c0 by Mrjtjmn at 2026-05-23T18:44:19-04:00 Fix ambiguous syntax of BangPatterns in users guide Update documentation for the BangPatterns extension to specify how surrounding whitespace affects interpretation of `!`. * Only when there is whitespace before `!` and no whitespace after, it is recognized as a BangPattern. * Other cases `⟨varid⟩!⟨varid⟩`, `⟨varid⟩ ! ⟨varid⟩`, `⟨varid⟩! ⟨varid⟩` are treated as infix operators. - - - - - 2b9445a6 by Simon Peyton Jones at 2026-05-25T11:43:21+01:00 Drastically reduce the use of the coercion optimiser This MR addresess #26679 by calling the coercion optimiser much less often; the coercion optimiser is expensive, and often ineffective, especially when it is called repeatedly. See Note [Coercion optimisation] in GHC.Core.Corecion.Opt. Specifically * Make coercion optimisation into its own pass, controlled by its own flag `-fopt-coercion` like any other pass. The pass runs early in the pipeline. * The Simplifier now contents itself with merely applying the current substitution to a coercion, and checking for reflexivity. * Kill off OptCoercionOpts, which is now unused. Another important, but only loosely related, improvement * In `GHC.Core.Subst.substIdBndr`, `GHC.Core.TyCo.Subst.substTyVarBndrUsing`, and `GHC.Core.TyCo.Subst.substTyVarBndrUsing`, check for an empty substitution. This keeps substitutions empty in the no-op case. See Note [Keeping the substitution empty] in GHC.Core.TyCo.Subst Compile time improves. Here are the compile-time allocation change over 1%: Baseline Test value Change ------------------------------------------------------------ CoOpt_Singletons(normal) 721,677,974 -7.9% GOOD LargeRecord(normal) 1,268,094,410 -20.4% GOOD T12545(normal) 772,150,124 -9.2% T12707(normal) 777,720,918 -1.5% GOOD T14766(normal) 918,228,179 -50.2% GOOD T15703(normal) 318,141,541 +1.0% BAD T18223(normal) 371,496,473 -7.6% GOOD T1969(normal) 670,830,326 +2.2% BAD T20261(normal) 573,444,953 -2.2% T24984(normal) 87,836,660 -1.5% T3064(normal) 171,636,592 -6.2% GOOD T5030(normal) 148,301,062 -16.4% GOOD T5321Fun(normal) 263,120,022 -3.3% GOOD T8095(normal) 777,033,006 -71.3% GOOD T9020(optasm) 222,159,574 -2.5% GOOD T9630(normal) 873,422,584 -15.4% GOOD T9872b(normal) 1,906,890,318 -2.9% GOOD T9872b_defer(normal) 2,878,170,737 -2.1% GOOD T9872d(normal) 356,978,798 -7.7% GOOD TcPlugin_RewritePerf(normal) 2,132,138,060 -2.6% GOOD geo. mean -2.7% minimum -71.3% maximum +2.2% Metric Decrease: CoOpt_Singletons LargeRecord T12707 T14766 T18223 T3064 T5030 T5321Fun T8095 T9020 T9630 T9872b T9872b_defer T9872d TcPlugin_RewritePerf Metric Increase: T15703 T1969 Serious attempt to avoid duplicating large coercions Progress on not-inlining coercions Add a type signature More on exported coercions More on coercion bindings Allow in letrec; indeed make the invariants for letrec the same as the invariants for top-level bindings. ToDo: document this Fix expression-equality for (Coercion co) We were just saying "True" which is utterly wrong. See Note [Equality for coercions] in GHC.Core.Map.Type Wibbles on coercion bindings Try a very cheap coercion optimiser Comments -- almost all just about core invariants Fuse optCoRefl and substCo Maybe this will be better than either Update Notes about core binding invariants T26332 really should fail with -dlinear-core-lint Try switching off the big optCoercion except in O2 Comments only Try dropping all optimisation The Simplifier just calls substCo, instead of optCoRefl Flags for tracing coercion sizes More optCoRefl * Deal with submultiplicities * In InitialPhase run even with empty subst Update user manual Care with the simple refl optimiser Improve the gobbler Fix warning Add changelog - - - - - 40b85323 by Simon Peyton Jones at 2026-05-25T11:43:21+01:00 More wibbles In particular, don't run any optimisation in the simple optimiser. - - - - - 84 changed files: - + changelog.d/elem-via-foldr-27096 - + changelog.d/ghc-pkg-faster-closure - + changelog.d/opt-coercion - compiler/GHC/Builtin/PrimOps.hs - compiler/GHC/CmmToLlvm/Base.hs - compiler/GHC/Core.hs - compiler/GHC/Core/Coercion.hs - compiler/GHC/Core/Coercion/Opt.hs - compiler/GHC/Core/FVs.hs - compiler/GHC/Core/LateCC/TopLevelBinds.hs - compiler/GHC/Core/Lint.hs - compiler/GHC/Core/Make.hs - compiler/GHC/Core/Map/Expr.hs - compiler/GHC/Core/Map/Type.hs - compiler/GHC/Core/Opt/CSE.hs - compiler/GHC/Core/Opt/ConstantFold.hs - compiler/GHC/Core/Opt/FloatIn.hs - compiler/GHC/Core/Opt/Monad.hs - compiler/GHC/Core/Opt/Pipeline.hs - compiler/GHC/Core/Opt/Pipeline/Types.hs - compiler/GHC/Core/Opt/SetLevels.hs - compiler/GHC/Core/Opt/Simplify/Env.hs - compiler/GHC/Core/Opt/Simplify/Iteration.hs - compiler/GHC/Core/Opt/Simplify/Utils.hs - compiler/GHC/Core/Opt/Specialise.hs - compiler/GHC/Core/Ppr.hs - compiler/GHC/Core/Rules.hs - compiler/GHC/Core/SimpleOpt.hs - compiler/GHC/Core/TyCo/FVs.hs - compiler/GHC/Core/TyCo/Rep.hs - compiler/GHC/Core/TyCo/Subst.hs - compiler/GHC/Core/Utils.hs - compiler/GHC/CoreToIface.hs - compiler/GHC/CoreToStg.hs - compiler/GHC/CoreToStg/Prep.hs - compiler/GHC/Data/TrieMap.hs - compiler/GHC/Driver/Config.hs - compiler/GHC/Driver/Config/Core/Lint.hs - compiler/GHC/Driver/Config/Core/Opt/Simplify.hs - compiler/GHC/Driver/DynFlags.hs - compiler/GHC/Driver/Flags.hs - compiler/GHC/Driver/Session.hs - compiler/GHC/HsToCore/Foreign/JavaScript.hs - compiler/GHC/Iface/Binary.hs - compiler/GHC/Iface/Make.hs - compiler/GHC/Iface/Rename.hs - compiler/GHC/Iface/Syntax.hs - compiler/GHC/Iface/Tidy.hs - compiler/GHC/Iface/Type.hs - compiler/GHC/IfaceToCore.hs - compiler/GHC/Parser/Lexer.x - compiler/GHC/Stg/Lint.hs - compiler/GHC/Stg/Pipeline.hs - compiler/GHC/StgToJS/Ids.hs - compiler/GHC/Tc/Types.hs - compiler/GHC/Tc/Utils/Monad.hs - compiler/GHC/Types/Id.hs - compiler/GHC/Types/Literal.hs - compiler/GHC/Types/Name/Cache.hs - compiler/GHC/Types/Unique.hs - compiler/GHC/Types/Unique/Supply.hs - compiler/GHC/Types/Var/Env.hs - compiler/GHC/Utils/Misc.hs - compiler/GHC/Utils/Outputable.hs - compiler/GHC/Utils/Trace.hs - docs/users_guide/debugging.rst - docs/users_guide/exts/stolen_syntax.rst - docs/users_guide/using-optimisation.rst - libraries/base/changelog.md - libraries/base/tests/perf/ElemNoFusion_O1.stderr - libraries/base/tests/perf/ElemNoFusion_O2.stderr - libraries/ghc-internal/src/GHC/Internal/List.hs - testsuite/tests/count-deps/CountDepsAst.stdout - testsuite/tests/count-deps/CountDepsParser.stdout - + testsuite/tests/ghc-api/T27273.hs - testsuite/tests/ghc-api/all.T - testsuite/tests/linear/should_compile/T26332.hs - testsuite/tests/linear/should_compile/all.T - testsuite/tests/printer/Makefile - + testsuite/tests/printer/PprQualifiedStrings.hs - + testsuite/tests/printer/Test27291.hs - testsuite/tests/printer/all.T - utils/check-exact/ExactPrint.hs - utils/ghc-pkg/Main.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/843b9a2a0d9b8f99528a6f45053b7aa... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/843b9a2a0d9b8f99528a6f45053b7aa... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Peyton Jones (@simonpj)