[Git][ghc/ghc][wip/ghc-9.6-backports] 37 commits: x86 Codegen: Implement MO_S_MulMayOflo for W16

Zubin (@wz1000) gitlab at gitlab.haskell.org
Tue Sep 19 06:12:43 UTC 2023



Zubin pushed to branch wip/ghc-9.6-backports at Glasgow Haskell Compiler / GHC


Commits:
9aedbee5 by Sven Tennie at 2023-09-19T11:40:57+05:30
x86 Codegen: Implement MO_S_MulMayOflo for W16

(cherry picked from commit 6c88c2ba89b33a22793a168ad781a086eb110769)

- - - - -
dc2487ba by Sven Tennie at 2023-09-19T11:40:57+05:30
x86 CodeGen: MO_S_MulMayOflo better error message for rep > W64

It's useful to see which value made the pattern match fail. (If it ever
occurs.)

(cherry picked from commit 5f1154e0e3339dd1cabf7a7129337d8aa191fca7)

- - - - -
d2db0289 by Sven Tennie at 2023-09-19T11:40:57+05:30
x86 CodeGen: Implement MO_S_MulMayOflo for W8

This case wasn't handled before. But, the test-primops test suite showed
that it actually might appear.

(cherry picked from commit e8c9a95febf7b18476fec816effc95cb3fcb93de)

- - - - -
94db871c by Sven Tennie at 2023-09-19T11:40:57+05:30
Add test for %mulmayoflo primop

The test expects a perfect implementation with no false positives.

(cherry picked from commit a36f9dc94823c75fb789710bc67b92e87a630440)

- - - - -
86e43bdb by Ben Gamari at 2023-09-19T11:40:57+05:30
testsuite: Mark MulMayOflo_full as broken rather than skipping

To ensure that we don't accidentally fix it.

See #23742.

(cherry picked from commit fd7ce39c70f8922e26b8be8a5fc4d6797987f66f)

- - - - -
65037411 by Ben Gamari at 2023-09-19T11:40:57+05:30
nativeGen/AArch64: Fix sign extension in MulMayOflo

Previously the 32-bit implementations of MulMayOflo would use the
a non-sensical sign-extension mode. Rewrite these to reflect what gcc 11
produces. Also similarly rework the 16- and 8-bit cases.

This now passes the MulMayOflo tests in ghc/test-primops> in all four
widths, including the precision tests.

Fixes #23721.

(cherry picked from commit 824092f28f52d32b6ea3cd26e1e576524ee24969)

- - - - -
a6846677 by Ben Gamari at 2023-09-19T11:40:57+05:30
compiler: Fingerprint more code generation flags

Previously our recompilation check was quite inconsistent in its
coverage of non-optimisation code generation flags. Specifically, we
failed to account for most flags that would affect the behavior of
generated code in ways that might affect the result of a program's
execution (e.g. `-feager-blackholing`, `-fstrict-dicts`)

Closes #23369.

(cherry picked from commit d1c92bf3b4b0b07a6a652f8fc31fd7b62465bf71)

- - - - -
c559cc62 by Andreas Klebinger at 2023-09-19T11:40:57+05:30
Arm: Fix lack of zero-extension for 8/16 bit add/sub with immediate.

For 32/64bit we can avoid explicit extension/zeroing as the instructions
set the full width of the registers.

When doing 16/8bit computation we have to put a bit more work in so we
can't use the fast path.

Fixes #23749 for 9.4.

(cherry picked from commit 0bb44f695bd008f03644e3d306566c50c5bd528c)

- - - - -
bc6429b7 by Ryan Scott at 2023-09-19T11:40:57+05:30
Restore mingwex dependency on Windows

This partially reverts some of the changes in !9475 to make `base` and
`ghc-prim` depend on the `mingwex` library on Windows. It also restores the
RTS's stubs for `mingwex`-specific symbols such as `_lock_file`.

This is done because the C runtime provides `libmingwex` nowadays, and
moreoever, not linking against `mingwex` requires downstream users to link
against it explicitly in difficult-to-predict circumstances. Better to always
link against `mingwex` and prevent users from having to do the guesswork
themselves.

See https://gitlab.haskell.org/ghc/ghc/-/merge_requests/10360#note_495873 for
the discussion that led to this.

(cherry picked from commit 2b1a4abe3f5935ca58c84c6073e6bdfa5160832f)

- - - - -
dbcb04bd by Ryan Scott at 2023-09-19T11:40:57+05:30
RtsSymbols.c: Remove mingwex symbol stubs

As of !9475, the RTS now links against `ucrt` instead of `msvcrt` on Windows,
which means that the RTS no longer needs to declare stubs for the `__mingw_*`
family of symbols. Let's remove these stubs to avoid confusion.

Fixes #23309.

(cherry picked from commit 289547580b6f2808ee123f106c3118b716486d5b)

- - - - -
a5af5c1a by Jaro Reinders at 2023-09-19T11:40:58+05:30
Make STG rewriter produce updatable closures

(cherry picked from commit 3930d793901d72f42b1535c85b746f32d5f3b677)

- - - - -
c0bec55a by Ben Gamari at 2023-09-19T11:40:58+05:30
users-guide: Support both distutils and packaging

As noted in #23818, some old distributions (e.g. Debian 9) only include
`distutils` while newer distributions only include `packaging`.

Fixes #23818.

(cherry picked from commit d814bda97994df01139c2a9bcde915dc86ef2927)

- - - - -
77386227 by Ben Gamari at 2023-09-19T11:40:58+05:30
users-guide: Ensure extlinks is compatible with Sphinx <4

The semantics of the `extlinks` attribute annoyingly changed in Sphinx
4. Reflect this in our configuration. See #22690.

Fixes #23807.

(cherry picked from commit 1726db3f39f1c41b92b1bdf45e9dc054b401e782)

- - - - -
9c046c69 by Krzysztof Gogolewski at 2023-09-19T11:40:58+05:30
Fix MultiWayIf linearity checking (#23814)

Co-authored-by: Thomas BAGREL <thomas.bagrel at tweag.io>
(cherry picked from commit edd8bc43566b3f002758e5d08c399b6f4c3d7443)

- - - - -
53c0184a by Gergő Érdi at 2023-09-19T11:40:58+05:30
If we have multiple defaulting plugins, then we should zonk in between them

after any defaulting has taken place, to avoid a defaulting plugin seeing
a metavariable that has already been filled.

Fixes #23821.

(cherry picked from commit 1d92f2dff6d1a170a44488d73cef81292591d120)

- - - - -
776647bf by Gergő Érdi at 2023-09-19T11:40:58+05:30
Improvements to the documentation of defaulting plugins

Based on @simonpj's draft and comments in !11117

(cherry picked from commit eaee4d296a0782c1acfde610ed3f0a7c7668c06c)

- - - - -
bdf011e2 by Matthew Pickering at 2023-09-19T11:40:58+05:30
driver: Check transitive closure of haskell package dependencies when deciding whether to relink

We were previously just checking whether direct package dependencies had
been modified. This caused issues when compiling without optimisations
as we wouldn't relink the direct dependency if one of its dependenices
changed.

Fixes #23724

(cherry picked from commit 291d81aef8083290da0d2ce430fbc5e5a33bdb6e)

- - - - -
692b26d1 by Ben Gamari at 2023-09-19T11:40:58+05:30
rts: Fix invalid symbol type

I suspect this code is dead since we haven't observed this failing
despite the obviously incorrect macro name.

(cherry picked from commit 9861f787a8323d03311e30851b10fdf100717afb)

- - - - -
9ab41a89 by Ben Gamari at 2023-09-19T11:40:58+05:30
testsuite: Add simple test exercising C11 atomics in GHCi

See #22012.

(cherry picked from commit 03ed6a9a634fd6c3ef35e9c5428b4a911e3f0add)

- - - - -
b2331e11 by Ben Gamari at 2023-09-19T11:40:58+05:30
rts/RtsSymbols: Add AArch64 outline atomic operations

Fixes #22012 by adding the symbols described in
https://github.com/llvm/llvm-project/blob/main/llvm/docs/Atomics.rst#libcalls-atomic.

Ultimately this would be better addressed by #22011, but this is a first
step in the right direction and fixes the immediate symptom.

Note that we dropped the `__arch64_cas16` operations as these provided
by all platforms's compilers. Also, we don't link directly against the
libgcc/compiler-rt definitions but rather provide our own wrappers to
work around broken toolchains (e.g. https://bugs.gentoo.org/868018).

Generated via https://gitlab.haskell.org/ghc/ghc/-/snippets/5733.

(cherry picked from commit 1aa5733a4480420fdc146322d86dd143321a3da6)

- - - - -
661b4908 by Matthew Craven at 2023-09-19T11:40:58+05:30
Unarise: Split Rubbish literals in function args

Fixes #23914.  Also adds a check to STG lint that
these args are properly unary or nullary after unarisation

(cherry picked from commit da30f0beb9e1820500382da02ffce96da959fa84)

- - - - -
582fc7d5 by Simon Peyton Jones at 2023-09-19T11:40:58+05:30
Tiny refactor

canEtaReduceToArity was only called internally, and always with
two arguments equal to zero.  This patch just specialises the
function, and renames it to cantEtaReduceFun.

No change in behaviour.

(cherry picked from commit 236a134eab4c0a3aae30752a3d580c083f4e6b57)

- - - - -
e32a4856 by Simon Peyton Jones at 2023-09-19T11:40:58+05:30
Fix eta reduction

Issue #23922 showed that GHC was bogusly eta-reducing a join point.
We should never eta-reduce (\x -> j x) to j, if j is a join point.

It is extremly difficult to trigger this bug.  It took me 45 mins of
trying to make a small tests case, here immortalised as T23922a.

(cherry picked from commit 6840012e5bb8f5c13e4bf7a4e4cbba0b06420aaa)

- - - - -
428438cd by Andreas Klebinger at 2023-09-19T11:40:58+05:30
Profiling: Properly escape characters when using `-pj`.

There are some ways in which unusual characters like quotes or others
can make it into cost centre names. So properly escape these.

Fixes #23924

(cherry picked from commit e5c00092a13f1a8cf53df2469e027012743cf59a)

- - - - -
ef74f5fb by Krzysztof Gogolewski at 2023-09-19T11:40:58+05:30
Fix wrong role in mkSelCo_maybe

In the Lint failure in #23938, we start with a coercion Refl :: T a ~R T a,
and call mkSelCo (SelTyCon 1 nominal) Refl.
The function incorrectly returned Refl :: a ~R a. The returned role
should be nominal, according to the SelCo rule:

      co : (T s1..sn) ~r0 (T t1..tn)
      r = tyConRole tc r0 i
      ----------------------------------
      SelCo (SelTyCon i r) : si ~r ti

In this test case, r is nominal while r0 is representational.

(cherry picked from commit e0aa8c6e3a8b6004eca9349e5b705b8a767050aa)

- - - - -
ceb1e37a by Finley McIlwaine at 2023-09-19T11:40:58+05:30
Add -dipe-stats flag

This is useful for seeing which info tables have information.

(cherry picked from commit cc52c358316ac8210f80da80db6b0c620dd5bdc3)

- - - - -
2e9adfc4 by Finley McIlwaine at 2023-09-19T11:40:58+05:30
Add -finfo-table-map-with-fallback -finfo-table-map-with-stack

The -fno-info-table-map-with-stack flag omits STACK info tables from the info
table map, and the -fno-info-table-map-with-fallback flag omits info tables
with defaulted source locations from the map. In a test on the Agda codebase
the build results were about 7% smaller when both of those types of tables
were omitted.

Adds a test that verifies that passing each combination of these flags
results in the correct output for -dipe-stats, which is disabled for the js
backend since profiling is not implemented.

This commit also refactors a lot of the logic around extracting info tables
from the Cmm results and building the info table map.

This commit also fixes some issues in the users guide rst source to fix
warnings that were noticed while debugging the documentation for these flags.

Fixes #23702

(cherry picked from commit 261c4acbfdaf5babfc57ab0cef211edb66153fb1)

- - - - -
aaf0e51a by Finley McIlwaine at 2023-09-19T11:40:58+05:30
Refactor estimation of stack info table provenance

This commit greatly refactors the way we compute estimated provenance for stack
info tables. Previously, this process was done using an entirely separate traversal
of the whole Cmm code stream to build the map from info tables to source locations.
The separate traversal is now fused with the Cmm code generation pipeline in
GHC.Driver.Main.

This results in very significant code generation speed ups when -finfo-table-map is
enabled. In testing, this patch reduces code generation times by almost 30% with
-finfo-table-map and -O0, and 60% with -finfo-table-map and -O1 or -O2 .

Fixes #23103

(cherry picked from commit d99c816f7b5727a3f344960e02a1932187ea093f)

- - - - -
4cb63bd3 by Finley McIlwaine at 2023-09-19T11:40:59+05:30
Add a test checking overhead of -finfo-table-map

We want to make sure we don't end up with poor codegen performance resulting from
-finfo-table-map again as in #23103. This test adds a performance test tracking
total allocations while compiling ExactPrint with -finfo-table-map.

(cherry picked from commit d3e0124c1157a4a423d86a1dc1d7e82c6d32ef06)

- - - - -
bc68fec5 by Ben Gamari at 2023-09-19T11:40:59+05:30
base: Advertise linear time of readFloat

As noted in #23538, `readFloat` has runtime that scales nonlinearly in
the size of its input. Consequently, its use on untrusted input can
be exploited as a denial-of-service vector. Point this out and suggest
use of `read` instead.

See #23538.

(cherry picked from commit b33113c86ce5888ff5edfd6d3dd95772d3c8abce)

- - - - -
d6e4d845 by Sylvain Henry at 2023-09-19T11:40:59+05:30
Add missing int64/word64-to-double/float rules (#23907)

CLC proposal: https://github.com/haskell/core-libraries-committee/issues/203

(cherry picked from commit 5126a2fef0385e206643b6af0543d10ff0c219d8)

- - - - -
1a769fff by Matthew Pickering at 2023-09-19T11:40:59+05:30
Build vanilla alpine bindists

We currently attempt to build and distribute fully static alpine
bindists (ones which could be used on any linux platform) but most
people who use the alpine bindists want to use alpine to build their own
static applications (for which a fully static bindist is not necessary).
We should build and distribute these bindists for these users whilst the
fully-static bindist is still unusable.

Fixes #23349

(cherry picked from commit 29be39ba3f187279b19cf451f2d8f58822edab4f)

- - - - -
dababb33 by Matthew Craven at 2023-09-19T11:40:59+05:30
Bump bytestring submodule to 0.11.5.1

(cherry picked from commit 43578d60bfc478e7277dcd892463cec305400025)

- - - - -
4fef381c by Zubin Duggal at 2023-09-19T11:40:59+05:30
Bump bytestring submodule to 0.11.5.2 (#23789)

(cherry picked from commit a98ae4ec6f4325c32c86cc0726947b6ecf4d047a)

- - - - -
22f0b766 by Zubin Duggal at 2023-09-19T11:40:59+05:30
Bump filepath submodule to 1.4.100.4
Bump bytestring submodule to 0.11.5.2

- - - - -
233d3d05 by Zubin Duggal at 2023-09-19T11:42:11+05:30
Update haddock submodule

- - - - -
697339f5 by Zubin Duggal at 2023-09-19T11:42:11+05:30
Prepare release 9.6.3

- - - - -


30 changed files:

- .gitlab-ci.yml
- .gitlab/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/fetch-gitlab-artifacts/fetch_gitlab.py
- compiler/GHC/Cmm.hs
- compiler/GHC/Cmm/MachOp.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Driver/Config/StgToCmm.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/GenerateCgIPEStub.hs
- compiler/GHC/Driver/Main.hs
- compiler/GHC/Driver/Pipeline.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Iface/Recomp/Flags.hs
- compiler/GHC/Runtime/Heap/Layout.hs
- compiler/GHC/Stg/Debug.hs
- compiler/GHC/Stg/InferTags/Rewrite.hs
- compiler/GHC/Stg/Lint.hs
- compiler/GHC/Stg/Unarise.hs
- compiler/GHC/StgToCmm/Config.hs
- compiler/GHC/StgToCmm/Prof.hs
- compiler/GHC/StgToCmm/Utils.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Solver.hs
- compiler/GHC/Tc/Types.hs
- compiler/GHC/Types/Literal.hs
- compiler/GHC/Types/RepType.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9c5458d06d4bf078c9ce01f2da34d1157c4d0b8b...697339f5502a36470cab47acdc10a1f6f5de4959

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/9c5458d06d4bf078c9ce01f2da34d1157c4d0b8b...697339f5502a36470cab47acdc10a1f6f5de4959
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/20230919/39624d1b/attachment-0001.html>


More information about the ghc-commits mailing list