Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC Commits: 0b528a99 by Simon Peyton Jones at 2026-11-25T18:36:20-05:00 Use a different herald for -ddump-simpl-trace ... so that we can more easily skip the high-volume ones - - - - - 6973772e by Simon Peyton Jones at 2026-11-25T18:36:20-05:00 Update comments and user manual This commit addresses the comment-related suggestions in #27973 - - - - - f61c3d97 by Simon Peyton Jones at 2026-11-25T18:36:20-05:00 Document and refactor eta-reduction documentation Triggered by #27212, this patch does several related things. * #27212 suggested that `findRhsArity` should ask for eta-expansion whenever the RHS's `manifestArity` is less than the arity it finds. That is a misconception: it deliberately compares with `exprArity`, which counts PAPs, so that we do not eta-expand PAPs (#9020). Switching to `manifestArity` makes compile time worse in T13960 and T13056. So this patch changes no code here; we continue to expand only to increase `exprArity` not `manifestArity`. Instead it documents the design in `findRhsArity`, `tryEtaExpandRhs`, `wantEtaExpansion` and Note [Do not eta-expand PAPs] (which now records the #27212 experiment). * Refactor GHC.Core.Opt.Arity.tryEtaReduce, which was hard to understand: - Accumulate an MCoercion rather than a Coercion, so the common no-cast case builds no coercions at all. - Separate equations of `go` for type and value arguments. For value arguments, the new `getTrivialHead_maybe` looks through any nesting of casts and floatable ticks, and `mkEtaReduceFunCo` builds the coercion. - Make the FunCo with `mkFunCo2` and compute its right-hand FunTyFlag from the coercion kinds. The cast can turn a Type-kinded argument into a Constraint-kinded one. New test T27212 covers this. - `mkEtaReduceForAllMCo` builds the ForAllCo for type arguments. It is tiresomely similar to `mkEtaForAllMCo`, but with the visibilities the other way round (#24014). It will go away again once !17006 lands. - New helper `mCoToCo` in GHC.Core.TyCo.Make. * Drop the checks on multiplicity in `tryEtaReduce`, which sometimes disabled eta-reduction. For example, (\x. K x) has type Int -> T, but the data constructor has type K :: Int %1 -> T, so we used to refuse to eta-reduce it to K. But Note [Linting linearity] in GHC.Core.Lint (EXAMPLE 4) already says that we do not preserve linearity under eta-reduction, so this change just puts that claim into practice. See (EtaMult) in Note [Eta reduction soundness]. Consequences in the testsuite: - T18052a: the pattern-synonym builder (\x y. (x,y)) is now just (,). - T21888a: the NOINLINE function (f x = Just x) becomes (f = Just), so f loses its CPR signature. The test is about demands, not CPR. * Tidy up the documentation of eta-reduction: - Relabel the criteria in Note [Eta reduction soundness] as (EtaA), (EtaS), (EtaR), (EtaE), (EtaT), (EtaJ), (EtaB) and (EtaW), and update all references to them. Also fix references to point (2) of Note [Eta reduction makes sense], which no longer exists. - Replace the confused "never reduce arity" bullet with an example in (EtaA), cross-referenced from Note [Arity robustness]. - Add historical notes (EtaMult) and (EtaBot). - Label the equations in Note [Eta reduction with casted arguments] (ECA1-4), and point to the code that implements them. LLM disclosure: I interacted with Claude a lot for this MR, but I wrote all the code and docs myself. - - - - - d928b862 by Zubin Duggal at 2026-11-25T18:36:21-05:00 linker: Remove DotA and DotDLL constructors of LinkablePart As far as I can, we have never actually used these constructors, and they have never appeared in a positive position, ever since they were introduced a long time ago. Foreign libraries aren't loaded through these either, that happens either through `loadPackages` which uses `LibrarySpec` or through 'loadCmdLineLibs' Also, a Linkable defines the build product of a single home module. DotA/DotDLL are library like things, so they don't fit into a Linkable anyway. - - - - - baeb5d23 by Zubin Duggal at 2026-11-25T18:36:21-05:00 Identify Linkable with fingerprints of their contents rather than modtimes - - - - - cfc4ce63 by Zubin Duggal at 2026-11-25T18:36:21-05:00 Linker cleanup delete a bunch of unused functions - - - - - c11bf569 by Zubin Duggal at 2026-11-25T18:36:21-05:00 Record constituent hashes for bytecode libraries A bytecode library now records the combined hash of its constituents, so relinking can be skipped when they haven't changed. - - - - - 8ad75445 by Zubin Duggal at 2026-11-25T18:36:21-05:00 bytecode: Give persistent bytecode files a fixed-size header with a hash The header of .gbc and .bytecodelib files now consists of the magic word, the compiler version and a hash, all with fixed-length encodings. The hash is the gbc_hash of a bytecode file, or the inputs hash of a bytecode library. readBinByteCodeHash and readBytecodeLibInputsHash now read only the header rather than the whole file. The version is written as its four numeric components instead of as a string. - - - - - 42054ea2 by Zubin Duggal at 2026-11-25T18:36:21-05:00 driver: Refresh ms_bytecode_date when reusing a ModSummary - - - - - 2b5443a7 by Zubin Duggal at 2026-11-25T18:36:21-05:00 bytecode: Treat persistent bytecode files with a bad header as stale - - - - - faa410f0 by Zubin Duggal at 2026-11-25T18:36:22-05:00 bytecode: Record the inputs hash in BytecodeLib ------------------------- Metric Increase: MultiLayerModulesRecomp MultiLayerModulesTH_Make MultiLayerModulesTH_OneShot ------------------------- - - - - - 760ebecc by Simon Jakobi at 2026-11-25T18:36:23-05:00 X86 NCG: use bt for single-bit tests Previously the Cmm patterns (x & (1 << i)) != 0 (x & (1 << i)) == 0 compiled to a mov/shl/and/test sequence. Now they compile to a single bt, followed directly by a jc/jae or setc/setae. As with btr/bts/btc, a literal single-bit mask that doesn't fit in an imm32, such as x & 0x10000000000, is now also tested with bt instead of being loaded into a register first. Data.Bits.testBit doesn't benefit yet when the bit index is variable: its bounds-checked shiftL wraps the shift in a mask that blocks this optimization. See Note [Bit-test instructions] in GHC.CmmToAsm.X86.CodeGen. Fixes #27688. Assisted-by: Claude Fable 5.1 - - - - - 72bfdd0b by Simon Jakobi at 2026-11-25T18:36:24-05:00 ci: Anchor the release branch pattern Branches with `ghc-X.Y` anywhere in their name, such as wip/ghc-9.16-backports, were treated as release branches. Each push started a full-ci branch pipeline next to the merge request pipeline, and its jobs pushed perf notes. Fixes #28172. Assisted-by: Claude Fable 5.2 - - - - - 2213c6c0 by Simon Jakobi at 2026-11-25T18:36:24-05:00 ci: Fix the release branch pattern of lint-submods-branch The pattern had `[0.9]` for `[0-9]`, so the job didn't run on ghc-10.0. Also anchor the pattern (#28172). Assisted-by: Claude Fable 5.2 - - - - - 9cbe46de by Simon Jakobi at 2026-11-25T18:36:25-05:00 ci: Retry some failed jobs automatically Let GitLab retry a job up to twice when it fails with one of these reasons: - runner_system_failure: the runner could not run the job. This is nearly always an image pull that fails before the job starts. - stuck_or_timeout_failure: GitLab dropped the job, either because its runner stopped reporting for an hour or because no runner picked it up within a day. Assisted-by: Claude Fable 5.2 - - - - - 887001f7 by Simon Jakobi at 2026-11-25T18:36:25-05:00 Correct some comments about unreachable Cmm blocks * ContFlowOpt claimed that maybe_concat drops every block that has no predecessors left. But a block that loses its predecessors to shortcutting stays in the graph. * The linear register allocator claimed that the Cmm pipeline keeps unreachable blocks away from it. But the NCG's own Cmm optimisations can make more blocks unreachable after the Cmm pipeline has run. It is sccBlocks that discards unreachable code before register allocation (#7574). Also: * Remove a commented-out trace in the linear allocator that predates #7574. * Say in Note [unreachable blocks] that any pass in cpsTop can encounter unreachable blocks. Rename it to Note [Unreachable blocks in the Cmm pipeline], so its title no longer differs only in case from an unrelated Note in GHC.Cmm.Dataflow. Context: #27368 Assisted-by: Claude Fable 5.2 - - - - - 65254f11 by mangoiv at 2026-11-25T18:36:26-05:00 ci: fix a bug where there's no runner that can pick up nightly push jobs - - - - - 2a619894 by Alan Zimmerman at 2026-11-25T18:36:27-05:00 EPA: Move setLayoutBoth inside markAnnListA The current refactoring aims to capture layout only in the `AnnList` exact print annotation. A consequence of this is that exact printing should only process layout when printing in the context of `AnnList`. To achieve this, this commit moves the layout printing enabler `setlayoutboth` into the `AnnList` processing. Future commits will remove the other occurrences. It also adds some tests to confirm it still works as intended, and cleans up some other unused functions. - - - - - 70 changed files: - .gitlab-ci.yml - .gitlab/ci.sh - .gitlab/generate-ci/gen_ci.hs - .gitlab/jobs.yaml - + changelog.d/T27212 - changelog.d/ncg-x86-bit-test-instructions - compiler/GHC/ByteCode/Binary.hs - compiler/GHC/ByteCode/Serialize.hs - compiler/GHC/Cmm.hs - compiler/GHC/Cmm/ContFlowOpt.hs - compiler/GHC/Cmm/Pipeline.hs - compiler/GHC/CmmToAsm/Reg/Linear.hs - compiler/GHC/CmmToAsm/X86/CodeGen.hs - compiler/GHC/CmmToAsm/X86/Instr.hs - compiler/GHC/CmmToAsm/X86/Ppr.hs - compiler/GHC/Core/Coercion.hs - compiler/GHC/Core/Opt/Arity.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/Opt/Specialise.hs - compiler/GHC/Core/TyCo/Make.hs - compiler/GHC/Core/Type.hs - compiler/GHC/Core/Utils.hs - compiler/GHC/Driver/Config/Core/Opt/Simplify.hs - compiler/GHC/Driver/Downsweep.hs - compiler/GHC/Driver/Main/Compile.hs - compiler/GHC/Driver/Main/Passes.hs - compiler/GHC/Driver/Pipeline.hs - compiler/GHC/Linker/ByteCode.hs - compiler/GHC/Linker/Deps.hs - compiler/GHC/Linker/Loader.hs - compiler/GHC/Linker/Types.hs - compiler/GHC/Unit/Finder.hs - compiler/GHC/Utils/Logger.hs - compiler/Language/Haskell/Syntax/Binds/InlinePragma.hs - docs/users_guide/debug-info.rst - docs/users_guide/using-optimisation.rst - + testsuite/tests/codeGen/should_gen_asm/T27688.asm - + testsuite/tests/codeGen/should_gen_asm/T27688.hs - + testsuite/tests/codeGen/should_gen_asm/T27688b.asm - + testsuite/tests/codeGen/should_gen_asm/T27688b.cmm - testsuite/tests/codeGen/should_gen_asm/all.T - testsuite/tests/dmdanal/sigs/T21888a.stderr - testsuite/tests/driver/bytecode-object/Makefile - testsuite/tests/driver/bytecode-object/all.T - + testsuite/tests/driver/bytecode-object/bytecode_object27.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object28.script - + testsuite/tests/driver/bytecode-object/bytecode_object28.stdout - + testsuite/tests/driver/bytecode-object/bytecode_object29.stdout - + testsuite/tests/driver/recomp023/M.hs - + testsuite/tests/driver/recomp023/M2.hs - + testsuite/tests/driver/recomp023/Makefile - + testsuite/tests/driver/recomp023/all.T - + testsuite/tests/driver/recomp023/recomp023.stdout - testsuite/tests/parser/should_compile/DumpSemis.hs - testsuite/tests/parser/should_compile/DumpSemis.stderr - + testsuite/tests/printer/Layout.hs - testsuite/tests/printer/Makefile - testsuite/tests/printer/T18052a.stderr - testsuite/tests/printer/all.T - testsuite/tests/simplCore/should_compile/T24726.stderr - + testsuite/tests/simplCore/should_compile/T27212.hs - testsuite/tests/simplCore/should_compile/all.T - utils/check-exact/ExactPrint.hs - utils/check-exact/Utils.hs The diff was not included because it is too large. View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8da4e77a3d77a02ff9159157f13702c... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8da4e77a3d77a02ff9159157f13702c... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help