-
b13482d0
by Simon Peyton Jones at 2026-11-26T02:38:27-05:00
Use a different herald for -ddump-simpl-trace
... so that we can more easily skip the high-volume ones
-
18f04ca1
by Simon Peyton Jones at 2026-11-26T02:38:27-05:00
Update comments and user manual
This commit addresses the comment-related suggestions in #27973
-
c73f2fb7
by Simon Peyton Jones at 2026-11-26T02:38:27-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.
-
842dd531
by Zubin Duggal at 2026-11-26T02:38:28-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.
-
4b6b5696
by Zubin Duggal at 2026-11-26T02:38:28-05:00
Identify Linkable with fingerprints of their contents rather than modtimes
-
a628d935
by Zubin Duggal at 2026-11-26T02:38:28-05:00
Linker cleanup
delete a bunch of unused functions
-
ccf20937
by Zubin Duggal at 2026-11-26T02:38:28-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.
-
1cd7855d
by Zubin Duggal at 2026-11-26T02:38:28-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.
-
e22a20d2
by Zubin Duggal at 2026-11-26T02:38:28-05:00
driver: Refresh ms_bytecode_date when reusing a ModSummary
-
81f472ca
by Zubin Duggal at 2026-11-26T02:38:29-05:00
bytecode: Treat persistent bytecode files with a bad header as stale
-
39b11783
by Zubin Duggal at 2026-11-26T02:38:29-05:00
bytecode: Record the inputs hash in BytecodeLib
-------------------------
Metric Increase:
MultiLayerModulesRecomp
MultiLayerModulesTH_Make
MultiLayerModulesTH_OneShot
-------------------------
-
4b9232c4
by Simon Jakobi at 2026-11-26T02:38:30-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
-
b992a8e5
by Simon Jakobi at 2026-11-26T02:38:31-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
-
0ed2d22c
by Simon Jakobi at 2026-11-26T02:38:31-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
-
0b89678c
by Simon Jakobi at 2026-11-26T02:38:32-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
-
e8f7ed35
by Simon Jakobi at 2026-11-26T02:38:33-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
-
d8e090d8
by Teo Camarasu at 2026-11-26T02:38:34-05:00
Skip tests that excercise forkProcess when using non-moving GC
The non-moving GC creates a persistent marker thread. This causes issues
when users use forkProcess, since the child process ends up in a strange
state.
forkProcess is documented to not work well with the threaded Haskell
runtime. So, it's not surprising that it doesn't work with the
non-moving GC which is inherently threaded.
We should one day add support for forkProcess, but, for now, we just
disable these tests when using the non-moving GC.
The underlying issue is tracked by #27547.
-
b77cfa91
by Wolfgang Jeltsch at 2026-11-26T02:38:35-05:00
Switch fingerprint caches to `FastString` keys
Resolves #28139.
-
04b6a41c
by mangoiv at 2026-11-26T02:38:36-05:00
ci: fix a bug where there's no runner that can pick up nightly push jobs
-
b238fd2b
by Alan Zimmerman at 2026-11-26T02:38:36-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.