[Git][ghc/ghc][wip/andreask/9.10-backports] 16 commits: Fix nasty bug in occurrence analyser
Andreas Klebinger (@AndreasK)
gitlab at gitlab.haskell.org
Wed Jan 22 14:11:53 UTC 2025
Andreas Klebinger pushed to branch wip/andreask/9.10-backports at Glasgow Haskell Compiler / GHC
Commits:
07393a24 by Simon Peyton Jones at 2025-01-22T14:45:04+01:00
Fix nasty bug in occurrence analyser
As #25096 showed, the occurrence analyser was getting one-shot info
flat out wrong.
This commit does two things:
* It fixes the bug and actually makes the code a bit tidier too.
The work is done in the new function
GHC.Core.Opt.OccurAnal.mkRhsOccEnv,
especially the bit that prepares the `occ_one_shots` for the RHS.
See Note [The OccEnv for a right hand side]
* When floating out a binding we must be conservative about one-shot
info. But we were zapping the entire demand info, whereas we only
really need zap the /top level/ cardinality.
See Note [Floatifying demand info when floating]
in GHC.Core.Opt.SetLevels
For some reason there is a 2.2% improvement in compile-time allocation
for CoOpt_Read. Otherwise nickels and dimes.
Metric Decrease:
CoOpt_Read
(cherry picked from commit f6b4c1c9be71fc6fe4688337752ffa4ad84180d9)
- - - - -
1ecd6116 by Arnaud Spiwack at 2025-01-22T14:45:11+01:00
Add tests for 25081
(cherry picked from commit e2f2a56e42d25bae178ae1692390bbbd6275176c)
- - - - -
850414e1 by Arnaud Spiwack at 2025-01-22T14:45:11+01:00
Scale multiplicity in list comprehension
Fixes #25081
(cherry picked from commit 23f50640e705c132f1a0689d4850866d0f0d76a6)
- - - - -
4c37bafd by doyougnu at 2025-01-22T14:45:11+01:00
Rts linker: add case for pc-rel 64 relocation
part of the upstream haskell.nix patches
(cherry picked from commit bfe4b3d3bbb98b39169fad063c6c32f06d167756)
- - - - -
6d3d44bb by Sylvain Henry at 2025-01-22T14:45:11+01:00
Only lookup ghcversion.h file in the RTS include-dirs by default.
The code was introduced in 3549c952b535803270872adaf87262f2df0295a4.
It used `getPackageIncludePath` which name doesn't convey that it looks
into all include paths of the preload units too. So this behavior is
probably unintentional and it should be ok to change it.
Fix #25106
(cherry picked from commit f954f42823f6ca3588425a0d543d93ace86d89e4)
- - - - -
2486f9d0 by Andreas Klebinger at 2025-01-22T14:45:11+01:00
Add since annotation for -fkeep-auto-rules.
This partially addresses #25082.
- - - - -
77fadb7e by Andreas Klebinger at 2025-01-22T14:45:11+01:00
Mention `-fkeep-auto-rules` in release notes.
It was added earlier but hadn't appeared in any release notes yet.
Partially addresses #25082.
- - - - -
0889c9e7 by Sylvain Henry at 2025-01-22T14:45:11+01:00
Cmm: don't perform unsound optimizations on 32-bit compiler hosts
- beef61351b240967b49169d27a9a19565cf3c4af enabled the use of
MO_Add/MO_Sub for 64-bit operations in the C and LLVM backends
- 6755d833af8c21bbad6585144b10e20ac4a0a1ab did the same for the x86 NCG
backend
However we store some literal values as `Int` in the compiler. As a
result, some Cmm optimizations transformed target 64-bit literals into
compiler `Int`. If the compiler is 32-bit, this leads to computing with
wrong literals (see #24893 and #24700).
This patch disables these Cmm optimizations for 32-bit compilers. This
is unsatisfying (optimizations shouldn't be compiler-word-size
dependent) but it fixes the bug and it makes the patch easy to backport.
A proper fix would be much more invasive but it shall be implemented in
the future.
Co-authored-by: amesgen <amesgen at amesgen.de>
(cherry picked from commit 7446a09a2d5b04b95cd43c03659b5647853124ce)
- - - - -
cec2db29 by Sylvain Henry at 2025-01-22T14:45:11+01:00
AARCH64 linker: skip NONE relocations
This patch is part of the patches upstreamed from haskell.nix.
See https://github.com/input-output-hk/haskell.nix/pull/1960 for the
original report/patch.
(cherry picked from commit c749bdfd3e21d712dc2b966482eb010165bdeebe)
- - - - -
2ecb9d68 by sheaf at 2025-01-22T14:45:11+01:00
GHCi debugger: drop record name spaces for Ids
When binding new local variables at a breakpoint, we should create
Ids with variable namespace, and not record field namespace. Otherwise
the rest of the compiler falls over because the IdDetails are wrong.
Fixes #25109
(cherry picked from commit c29b2b5a77611b2bd6c3089765079bc43aec3e22)
- - - - -
0028decc by Sylvain Henry at 2025-01-22T14:45:11+01:00
JS: support rubbish static literals (#25177)
Support for rubbish dynamic literals was added in #24664. This patch
does the same for static literals.
Fix #25177
(cherry picked from commit 5092dbff750ee5b6fd082b7eed8574922a2b0bf4)
- - - - -
14c6b834 by Arsen Arsenović at 2025-01-22T14:45:11+01:00
ghc-toolchain: Don't leave stranded a.outs when testing for -g0
This happened because, when ghc-toolchain tests for -g0, it does so by
compiling an empty program. This compilation creates an a.out.
Since we create a temporary directory, lets place the test program
compilation in it also, so that it gets cleaned up.
Fixes: 25b0b40467d0a12601497117c0ad14e1fcab0b74
Closes: https://gitlab.haskell.org/ghc/ghc/-/issues/25203
(cherry picked from commit b16605e7c135f8cfd357a60c7f358132faec6a84)
- - - - -
91e1572a by Cheng Shao at 2025-01-22T14:45:11+01:00
rts: fix checkClosure error message
This patch fixes an error message in checkClosure() when the closure
has already been evacuated. The previous logic was meant to print the
evacuated closure's type in the error message, but it was completely
wrong, given info was not really an info table, but a tagged pointer
that points to the closure's new address.
(cherry picked from commit 0d3bc2fa3a9a8c342ec34bb9d32e493655a4ec69)
- - - - -
90b3ad99 by Simon Peyton Jones at 2025-01-22T14:45:11+01:00
Add ZonkAny and document it
This MR fixed #24817 by adding ZonkAny, which takes a Nat
argument.
See Note [Any types] in GHC.Builtin.Types, especially
wrinkle (Any4).
(cherry picked from commit cfbff65a8bde902b4510cdaead847bf7a52b4018)
- - - - -
9f5046b3 by Cheng Shao at 2025-01-22T14:45:11+01:00
compiler: avoid saving foreign call target to local when there are no caller-save GlobalRegs
This patch makes the STG->Cmm backend avoid saving foreign call target
to local when there are no caller-save GlobalRegs.
Since 321941a8ebe25192cdeece723e1058f2f47809ea, when we lower a
foreign call, we unconditionally save the foreign call target to a
temporary local first, then rely on cmmSink to clean it up later,
which only happens with -fcmm-sink (implied by -O) and not in
unoptimized code.
And this is troublesome for the wasm backend NCG, which needs to infer
a foreign call target symbol's type signature from the Cmm call site.
Previously, the NCG has been emitting incorrect type signatures for
unoptimized code, which happens to work with `wasm-ld` most of the
time, but this is never future-proof against upstream toolchain
updates, and it causes horrible breakages when LTO objects are
included in linker input. Hence this patch.
(cherry picked from commit 8dd8a076058baca45ac52ace25b9c2797d61ef84)
- - - - -
c6e5b188 by Cheng Shao at 2025-01-22T14:45:11+01:00
testsuite: add callee-no-local regression test
(cherry picked from commit 986df1abe23aaad4142721fbdb7dd3791cf153ad)
- - - - -
30 changed files:
- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Builtin/Types.hs
- compiler/GHC/Cmm/Opt.hs
- compiler/GHC/Core/Opt/DmdAnal.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Driver/Config/StgToCmm.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/StgToCmm/Config.hs
- compiler/GHC/StgToCmm/Foreign.hs
- compiler/GHC/StgToJS/Literal.hs
- compiler/GHC/SysTools/Cpp.hs
- compiler/GHC/Tc/Gen/Match.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Tc/Utils/Monad.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/Types/Demand.hs
- compiler/GHC/Types/Id.hs
- compiler/GHC/Types/Id/Info.hs
- compiler/GHC/Utils/Outputable.hs
- docs/users_guide/9.10.2-notes.rst
- docs/users_guide/using-optimisation.rst
- rts/linker/PEi386.c
- rts/linker/elf_reloc_aarch64.c
- rts/sm/Sanity.c
- + testsuite/tests/codeGen/should_compile/T25177.hs
- + testsuite/tests/codeGen/should_compile/T25177.stderr
- testsuite/tests/codeGen/should_compile/all.T
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/38da6843656aa72c112e5fa29e0e9ecd50bd8b0b...c6e5b18825363b4a89d262de6d41a7844fab188d
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/38da6843656aa72c112e5fa29e0e9ecd50bd8b0b...c6e5b18825363b4a89d262de6d41a7844fab188d
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/20250122/1e38af90/attachment-0001.html>
More information about the ghc-commits
mailing list