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

Zubin (@wz1000) gitlab at gitlab.haskell.org
Mon Sep 18 10:02:42 UTC 2023



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


Commits:
bb094bab by Sven Tennie at 2023-09-18T15:31:31+05:30
x86 Codegen: Implement MO_S_MulMayOflo for W16

(cherry picked from commit 6c88c2ba89b33a22793a168ad781a086eb110769)

- - - - -
f63c9978 by Sven Tennie at 2023-09-18T15:31:31+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)

- - - - -
b515d3f5 by Sven Tennie at 2023-09-18T15:31:31+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)

- - - - -
22e7e5ab by Sven Tennie at 2023-09-18T15:31:31+05:30
Add test for %mulmayoflo primop

The test expects a perfect implementation with no false positives.

(cherry picked from commit a36f9dc94823c75fb789710bc67b92e87a630440)

- - - - -
c26a9c24 by Ben Gamari at 2023-09-18T15:31:31+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)

- - - - -
7d26ba71 by Ben Gamari at 2023-09-18T15:31:31+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)

- - - - -
5abfdabd by Ben Gamari at 2023-09-18T15:31:31+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)

- - - - -
92b52cb6 by Andreas Klebinger at 2023-09-18T15:31:31+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)

- - - - -
d83d9af9 by Ryan Scott at 2023-09-18T15:31:31+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)

- - - - -
e204cf09 by Ryan Scott at 2023-09-18T15:31:31+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)

- - - - -
b4402e6c by Jaro Reinders at 2023-09-18T15:31:31+05:30
Make STG rewriter produce updatable closures

(cherry picked from commit 3930d793901d72f42b1535c85b746f32d5f3b677)

- - - - -
c37b1633 by Ben Gamari at 2023-09-18T15:31:32+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)

- - - - -
3e647404 by Ben Gamari at 2023-09-18T15:31:32+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)

- - - - -
5cb287f0 by Krzysztof Gogolewski at 2023-09-18T15:31:32+05:30
Fix MultiWayIf linearity checking (#23814)

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

- - - - -
f6c25925 by Gergő Érdi at 2023-09-18T15:31:32+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)

- - - - -
1a1c9b34 by Gergő Érdi at 2023-09-18T15:31:32+05:30
Improvements to the documentation of defaulting plugins

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

(cherry picked from commit eaee4d296a0782c1acfde610ed3f0a7c7668c06c)

- - - - -
24802078 by Matthew Pickering at 2023-09-18T15:31:32+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)

- - - - -
b535d57d by Ben Gamari at 2023-09-18T15:31:32+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)

- - - - -
faa8061c by Ben Gamari at 2023-09-18T15:31:32+05:30
testsuite: Add simple test exercising C11 atomics in GHCi

See #22012.

(cherry picked from commit 03ed6a9a634fd6c3ef35e9c5428b4a911e3f0add)

- - - - -
4bd3981f by Ben Gamari at 2023-09-18T15:31:32+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)

- - - - -
f5a7f98f by Matthew Craven at 2023-09-18T15:31:32+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)

- - - - -
88326846 by Simon Peyton Jones at 2023-09-18T15:31:32+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)

- - - - -
74602e47 by Simon Peyton Jones at 2023-09-18T15:31:32+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)

- - - - -
14ea47b9 by Andreas Klebinger at 2023-09-18T15:31:32+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)

- - - - -
2d208f6e by Krzysztof Gogolewski at 2023-09-18T15:31:32+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)

- - - - -
b519e9e5 by Finley McIlwaine at 2023-09-18T15:31:32+05:30
Add -dipe-stats flag

This is useful for seeing which info tables have information.

(cherry picked from commit cc52c358316ac8210f80da80db6b0c620dd5bdc3)

- - - - -
7385b301 by Finley McIlwaine at 2023-09-18T15:31:32+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)

- - - - -
bbd31334 by Finley McIlwaine at 2023-09-18T15:31:32+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)

- - - - -
ea626070 by Finley McIlwaine at 2023-09-18T15:31:32+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)

- - - - -
982595da by Ben Gamari at 2023-09-18T15:31:33+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)

- - - - -
b4c57611 by Sylvain Henry at 2023-09-18T15:31:33+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)

- - - - -
2215afaf by Matthew Pickering at 2023-09-18T15:31:33+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)

- - - - -
a26ae0fe by Matthew Craven at 2023-09-18T15:31:33+05:30
Bump bytestring submodule to 0.11.5.1

(cherry picked from commit 43578d60bfc478e7277dcd892463cec305400025)

- - - - -
85367b45 by Zubin Duggal at 2023-09-18T15:31:33+05:30
Bump bytestring submodule to 0.11.5.2 (#23789)

(cherry picked from commit a98ae4ec6f4325c32c86cc0726947b6ecf4d047a)

- - - - -
91403b7a by Zubin Duggal at 2023-09-18T15:31:33+05:30
Bump filepath submodule to 1.4.100.4
Bump bytestring submodule to 0.11.5.2

- - - - -
9c5458d0 by Zubin Duggal at 2023-09-18T15:31:33+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/49cd8d36659994e0391364b82347a460b24f78ca...9c5458d06d4bf078c9ce01f2da34d1157c4d0b8b

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/49cd8d36659994e0391364b82347a460b24f78ca...9c5458d06d4bf078c9ce01f2da34d1157c4d0b8b
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/20230918/750bfb58/attachment-0001.html>


More information about the ghc-commits mailing list