| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This backports the fix suggested in #23184 to GHC-9.4
It is from the larger patch (!7861):
```
commit 6656f0165a30fc2a22208532ba384fc8e2f11b46
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date: Fri Jul 23 23:57:01 2021 +0100
A bunch of changes related to eta reduction
This is a large collection of changes all relating to eta
reduction, originally triggered by #18993, but there followed
a long saga.
Specifics:
...lots of lines omitted...
Other incidental changes
* Fix a fairly long-standing outright bug in the ApplyToVal case of
GHC.Core.Opt.Simplify.mkDupableContWithDmds. I was failing to take the
tail of 'dmds' in the recursive call, which meant the demands were All
Wrong. I have no idea why this has not caused problems before now.
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was an outright bug, which Simon fixed in July 2021, as a little side-fix on a complicated patch:
```
commit 6656f0165a30fc2a22208532ba384fc8e2f11b46
Author: Simon Peyton Jones <simonpj@microsoft.com>
Date: Fri Jul 23 23:57:01 2021 +0100
A bunch of changes related to eta reduction
This is a large collection of changes all relating to eta
reduction, originally triggered by #18993, but there followed
a long saga.
Specifics:
...lots of lines omitted...
Other incidental changes
* Fix a fairly long-standing outright bug in the ApplyToVal case of
GHC.Core.Opt.Simplify.mkDupableContWithDmds. I was failing to take the
tail of 'dmds' in the recursive call, which meant the demands were All
Wrong. I have no idea why this has not caused problems before now.
```
Note this "Fix a fairly longstanding outright bug". This is the specific fix
```
@@ -3552,8 +3556,8 @@ mkDupableContWithDmds env dmds
-- let a = ...arg...
-- in [...hole...] a
-- NB: sc_dup /= OkToDup; that is caught earlier by contIsDupable
- do { let (dmd:_) = dmds -- Never fails
- ; (floats1, cont') <- mkDupableContWithDmds env dmds cont
+ do { let (dmd:cont_dmds) = dmds -- Never fails
+ ; (floats1, cont') <- mkDupableContWithDmds env cont_dmds cont
; let env' = env `setInScopeFromF` floats1
; (_, se', arg') <- simplArg env' dup se arg
; (let_floats2, arg'') <- makeTrivial env NotTopLevel dmd (fsLit "karg") arg'
```
Ticket #23184 is a report of the bug that this diff fixes.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
As noted in #22561, it is important that GHC's toolchain look
first for its own headers and libraries to ensure that the
system's are not found instead. If this happens things can
break in surprising ways (e.g. see #22561).
(cherry picked from commit 8071efc307ba2df7362ff3b96c898afc61addc21)
|
| |
|
|
|
|
|
|
|
| |
Previously I used LLVM's `unordered` ordering for the C11 `relaxed`
ordering. However, this is wrong and should rather use the LLVM
`monotonic` ordering.
Fixes #22640
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rather conservatively return Top.
See Note [Untyped demand on case-alternative binders].
I also factored `addCaseBndrDmd` into two separate functions `scrutSubDmd` and
`fieldBndrDmds`.
Fixes #22039.
(cherry picked from commit d2be80fd9b222963e8dd09a30f78c106e00da7f9)
|
|
|
|
|
|
|
|
|
| |
See the updated `Note [Data-con worker strictness]`
and the new `Note [Demand transformer for data constructors]`.
Fixes #22475.
(cherry picked from commit b4cfa8e235715d8c73b2ba0ba05ed8ef92629218)
|
|
|
|
|
|
|
| |
This is in general unsafe as they may be clobbered if they are mapped to
caller-saved machine registers. See Note [Register parameter passing].
(cherry picked from commit 9372329008143104b0ae5e8e792e957090dfa743)
|
|
|
|
|
|
|
|
|
| |
Originally I had thought I would just use the `prim` call syntax instead
of introducing new syntax for atomic loads. However, it turns out that
`prim` call syntax tends to make things quite unreadable. This new
syntax seems quite natural.
(cherry picked from commit 748490d2ff51d6c6fa44aad587908b271c801fa9)
|
|
|
|
| |
(cherry picked from commit 6c9862c4fee395345dbbcd8ad58ae3f08753219e)
|
|
|
|
| |
(cherry picked from commit 6cc3944a06cc5be302bb023a43c0537838b50861)
|
|
|
|
| |
(cherry picked from commit 8faf74fcbd9d9da81ce8a901d694711c5d7ad406)
|
|
|
|
| |
(cherry picked from commit 43beaa7baf02d75946c37974fbe46d2857920a53)
|
|
|
|
| |
(cherry picked from commit 34f6b09c8e985017c4b18896aeac0c20baf4433d)
|
|
|
|
| |
(cherry picked from commit da7b51d8598400ed8073afe1b311c73a04e2230d)
|
|
|
|
|
|
|
|
|
|
|
| |
... thus fixing #22549.
The details are in the refurbished and no longer dead
`Note [Do not strictify a DFun's parameter dictionaries]`.
There's a regression test in T22549.
(cherry picked from commit 26e71562072f6740d52fcd38298340c287a641b8)
|
|
|
|
|
|
| |
Addresses #20017 for 9.4.4.
(cherry picked from commit 0f63c830abf0778c5b6c073d36dc6377844aa087)
|
|
|
|
|
|
|
|
|
| |
Here we add acquire and release barriers in readMutVar# and
writeMutVar#, which are necessary for soundness.
Fixes #22468.
(cherry picked from commit a9834736a90aefdd32cfc15be507e22b57eedc07)
|
|
|
|
|
|
|
|
|
|
| |
Previously we were just looking at the direct imports to try and work
out what a package qualifier could apply to but #22333 pointed out we
also needed to look for reexported modules.
Fixes #22333
(cherry picked from commit 58a138d0f62c057333e4fd15fe20df64492b1dac)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes https://gitlab.haskell.org/ghc/ghc/-/issues/22099
I cannot say for sure that this will fix the linked issue, but
I explained why I believe this fixes the root problem in:
https://gitlab.haskell.org/ghc/ghc/-/issues/22099#note_461386
… and when we applied this patch internally the problem appeared to
disappear for a few builds in a row with a large number of cores.
The short summary of the above comment is that the `Makefile`
serializes the package registrations using `ghc-pkgs`, with the
exception of two packages (`rts` and `system-cxx-std-lib`) and
we expect that this one instance of parallelism that was still
left in the `Makefile` was the root cause of the flaky build
failure.
This fix would be consistent with two known things about the
failure:
- The build failure only occurs for parallel `Make` builds
… and these are the only two `ghc-pkg` calls that run concurrently
- The error first appeared in the GHC 9.4 branch and was absent in GHC 9.2
… and GHC 9.4 was the first release that included `system-cxx-std-lib`
(as far as I know), which would explain why this problem
didn't happen before.
The change here forces the two packages to be registered in
sequence.
This problem will of course go away in GHC 9.6 by virtue of
dropping the `make`-based build, but since the GHC 9.4 branch is
supported and active we wanted to upstream this patch to the
9.4 development branch.
|
|
|
|
|
|
| |
Fixes #22416
(cherry picked from commit 294f907370fadd3313f8c5e6aa87a93c8b86f139)
|
|
|
|
|
|
|
|
|
| |
It now properly lints cases where sums end up distributed
over multiple args after unarise.
Fixes #22026.
(cherry picked from commit 8d2dbe2db4cc7c8b6d39b1ea64b0508304a3273c)
|
|
|
|
| |
(cherry picked from commit f7b7a3122185222d5059e37315991afcf319e43c)
|
|
|
|
|
|
|
|
|
|
|
|
| |
As noted in #22297, SIMD vector registers can be used
to store different kinds of values, e.g. xmm1 can be used
both to store integer and floating point values.
The Cmm type system doesn't properly account for this, so
we weaken the Cmm register assignment lint check to only
compare widths when comparing a vector type with its
allocated vector register.
(cherry picked from commit 3be48877e204fca8e5d5ab984186e0d20d81f262)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch makes it so that packing/unpacking SIMD
vectors always uses the right sized types, e.g.
unpacking a Word16X4# will give a tuple of Word16#s.
As a result, we can get rid of the conversion instructions
that were previously required.
Fixes #22296
(cherry picked from commit 6d7d91817795d7ee7f45557411368a1738daa488)
|
|
|
|
|
|
|
|
|
|
|
| |
This patch adds the missing `VecRep` case to `primRepSlot` function and
all the necessary machinery to carry this new `VecSlot` through code
generation. This allows programs involving unboxed sums of SIMD vectors
to be written and compiled.
Fixes #22187
(cherry picked from commit 5b3a992f5d166007c3c5a22f120ed08e0a27f01a)
|
|
|
|
|
|
|
|
|
| |
Unboxed sums might store a Int8# value as Int64#. This patch
makes sure we keep track of the actual value type.
See Note [Casting slot arguments] for the details.
(cherry picked from commit 31462d98c31e3ef48af2f6c6f2d379d74ccc63f5)
|
|
|
|
|
|
|
|
|
|
| |
This reverts the workaround introduced in
f63c8ef33ec9666688163abe4ccf2d6c0428a7e7, which taught our response file
logic to write response files with the `latin1` encoding to workaround
`gcc`'s lacking Unicode support. This is now no longer necessary (and in
fact actively unhelpful) since we rather use Clang.
(cherry picked from commit 30f0d9a9ded55a822e094847d5ac8087262fb8da)
|
|
|
|
|
|
|
| |
As noted in #12971, we previously used `show` which resulted in
inappropriate escaping of non-ASCII characters.
(cherry picked from commit a4dbd102af1989526ca87f4dd949f72231284e68)
|
|
|
|
|
|
|
|
|
|
|
| |
The `withDeferredDiagnostics` wrapper wasn't doing anything because the
session it was modifying wasn't used in hsc_env. Therefore the fix is
simple, just push the `getSession` call into the scope of
`withDeferredDiagnostics`.
Fixes #22391
(cherry picked from commit 6dab0046b575e102bf3245fd63d5ac6bc6f4204d)
|
|
|
|
|
|
|
|
|
|
|
| |
The refactoring in 866c736e introduced a rather subtle change in the
semantics of the IPE eventlog output, changing the eventlog field from
encoding info table pointers to "TNTC pointers" (which point to entry
code when tables-next-to-code is enabled). Fix this.
Fixes #22452.
(cherry picked from commit 268a3ce952f6be00a1dd164dc4d7acb346045e90)
|
|
|
|
|
|
| |
Fixes #22453
(cherry picked from commit 68c966cd3c9d581bac4573807e433fe8d063445f)
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This subtle bug showed up when compiling a library with 9.4.
See #22491. The bug is present in master, but it is hard to
trigger; the new regression test T22491 fails in 9.4.
The fix was easy: just add a missing varToCoreExpr in
etaBodyForJoinPoint.
The fix is definitely right though!
(cherry picked from commit afc2540daf6ca6baa09ab147b792da08d66d878c)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RTS eventlog events for postCapsetVecEvent are truncated if payload
is larger than EVENT_PAYLOAD_SIZE_MAX
Previously, postCapsetVecEvent records eventlog event with payload
of variable size larger than EVENT_PAYLOAD_SIZE_MAX (2^16) without
any validation, resulting in corrupted data.
For example, this happens when a Haskell binary is invoked with very
long command line arguments exceeding 2^16 bytes (see #20221).
Now we check the size of accumulated payload messages incrementally,
and truncate the message just before the payload size exceeds
EVENT_PAYLOAD_SIZE_MAX. RTS will warn the user with a message showing
how many arguments are truncated.
(cherry picked from commit 2057c77d08cb8422857d182a3691f98dccd0c7d6)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There was some confusion in Data.Typeable about which module certain
wired-in things were defined in. Just because something is wired-in
doesn't mean it comes from GHC.Prim, in particular things like LiftedRep
and RuntimeRep are defined in GHC.Types and that's the end of the story.
Things like Int#, Float# etc are defined in GHC.Prim as they have no
Haskell definition site at all so we need to generate type
representations for them (which live in GHC.Types).
Fixes #22510
(cherry picked from commit 1d3a8b8ec98e6eedf8943e19780ec374c2491e7f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This improves the error messages of the exhaustiveness checker when
checking statements which have been moved around with ApplicativeDo.
Before:
Test.hs:2:3: warning: [GHC-62161] [-Wincomplete-uni-patterns]
Pattern match(es) are non-exhaustive
In a pattern binding:
Patterns of type ‘Maybe ()’ not matched: Nothing
|
2 | let x = ()
| ^^^^^^^^^^
After:
Test.hs:4:3: warning: [GHC-62161] [-Wincomplete-uni-patterns]
Pattern match(es) are non-exhaustive
In a pattern binding:
Patterns of type ‘Maybe ()’ not matched: Nothing
|
4 | ~(Just res1) <- seq x (pure $ Nothing @())
|
Fixes #22483
(cherry picked from commit 74c767df770766d8d52e87b9ff7da10f94620a91)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Through a mistake in the latest backport we started eta-expanding over
expensive work by mistake. E.g. over <expensive> in code like:
case x of
A -> id
B -> <expensive>
We fix this by only eta-expanding over <expensive> if all other branches
are headed by an oneShot lambda.
In the long story of broken eta-expansion on 9.2/9.4 this is hopefully
the last chapter.
-------------------------
Metric Increase:
CoOpt_Read
T1969
parsing001
TcPlugin_RewritePerf
LargeRecord
-------------------------
|
|
|
|
|
| |
Instead of `` `cast` <Co:11> :: (Some -> Really -> Large Type)``
simply print `` `cast` <Co:11> :: ... ``
|
| |
|
|
|
|
| |
This reverts commit 5ec22f0135483ea8a8a543c53dcc7f9d7f6a8dea.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This MR fixes #21694 and #21755
* For #21694 the underlying problem was that we were calling arityType
on an expression that had free join points. This is a Bad Bad Idea.
See Note [No free join points in arityType].
* I also made andArityType work correctly with -fpedantic-bottoms;
see Note [Combining case branches: andWithTail].
* I realised that, now we have ae_sigs giving the ArityType for
let-bound Ids, we don't need the (pre-dating) special code in
arityType for join points. But instead we need to extend the env for
Rec bindings, which weren't doing before. More uniform now. See
Note [arityType for let-bindings].
This meant we could get rid of ae_joins, and in fact get rid of
EtaExpandArity altogether. Simpler.
And finally, it was the strange treatment of join-point Ids (involving
a fake ABot type) that led to a serious bug: #21755. Fixed by this
refactoring
* Rewrote Note [Combining case branches: optimistic one-shot-ness]
Compile time improves slightly on average:
Metrics: compile_time/bytes allocated
---------------------------------------------------------------------------------------
CoOpt_Read(normal) ghc/alloc 803,788,056 747,832,680 -7.1% GOOD
T18223(normal) ghc/alloc 928,207,320 959,424,016 +3.1% BAD
geo. mean -0.3%
minimum -7.1%
maximum +3.1%
On Windows it's a bit better: geo mean is -0.6%, and three more
benchmarks trip their compile-time bytes-allocated threshold (they
were all close on the other build):
T18698b(normal) ghc/alloc 235,619,776 233,219,008 -1.0% GOOD
T6048(optasm) ghc/alloc 112,208,192 109,704,936 -2.2% GOOD
T18140(normal) ghc/alloc 85,064,192 83,168,360 -2.2% GOOD
I had a quick look at T18223 but it is knee deep in coercions and
the size of everything looks similar before and after. I decided
to accept that 3.4% increase in exchange for goodness elsewhere.
Metric Decrease:
CoOpt_Read
LargeRecord
ManyAlternatives
ManyConstructors
MultiComponentModules
MultiComponentModulesRecomp
T10421
T12425
T12707
T13035
T13253
T13379
T14683
T15703
T18698a
T1969
T3064
T3294
T4801
T5321FD
T5321Fun
T5631
T783
T9020
T9198
T9233
T9872b
T9872c
T9961
parsing001
Metric Increase:
T18223
(cherry picked from commit 5e282da37e19a1ab24ae167daf32276a64ed2842)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For the code
{-# LANGUAGE OverloadedRecordUpdate #-}
operatorUpdate f = f{(+) = 1}
There are no exact print annotations for the parens around the +
symbol, nor does normal ppr print them.
This MR fixes that.
Closes #21805
(cherry picked from commit 792ef44d455c6e987f342fb61515464322a9fa77)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The issue is that when we compile a typed bracket we replace the splice
with HsSpliced (unTypeCode ...).
Then when computing types for
> [|| T $$(...) ||]
GHC is asked to compute the type of `T $$(..)`, which panics because
of the bogus type of T applied to `HsSpliced`, which is not type
correct.
The fix is to not attempt to compute the type for `HsSpliceE`
constructors if we come across them as they should have either been
already evaluated or lifted into a splice environment.
As part of the patch I made hie files traverse into the splice
environments so now we also get type information for things used inside
nested splices.
Fixes #21619
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Metric Decrease:
T18923
Metric Increase:
ManyAlternatives
ManyConstructors
MultiComponentModules
MultiComponentModulesRecomp
T18282
T5642
T10421
T12150
T12234
T12425
T12707
T13035
T13056
T13379
T13719
T14697
T15703
T16577
T16875
T18140
T18698a
T18698b
T1969
T20049
T3064
T3294
T4801
T4978
T5321FD
T5321Fun
T7257
T783
T9020
T9198
T9233
T9961
WWRec
|
| |
|