[Git][ghc/ghc][wip/simplifier-tweaks] 80 commits: Improve duplicate elimination in SpecConstr

Simon Peyton Jones (@simonpj) gitlab at gitlab.haskell.org
Tue Jan 9 17:52:06 UTC 2024



Simon Peyton Jones pushed to branch wip/simplifier-tweaks at Glasgow Haskell Compiler / GHC


Commits:
28811f88 by Simon Peyton Jones at 2023-12-08T05:47:18-05:00
Improve duplicate elimination in SpecConstr

This partially fixes #24229.

See the new Note [Pattern duplicate elimination] in SpecConstr

- - - - -
fec7894f by Simon Peyton Jones at 2023-12-08T05:47:18-05:00
Make SpecConstr deal with casts better

This patch does two things, to fix #23209:

* It improves SpecConstr so that it no longer quantifies over
  coercion variables.  See Note [SpecConstr and casts]

* It improves the rule matcher to deal nicely with the case where
  the rule does not quantify over coercion variables, but the the
  template has a cast in it.  See Note [Casts in the template]

- - - - -
8db8d2fd by Zubin Duggal at 2023-12-08T05:47:54-05:00
driver: Don't lose track of nodes when we fail to resolve cycles

The nodes that take part in a cycle should include both hs-boot and hs files,
but when we fail to resolve a cycle, we were only counting the nodes from the
graph without boot files.

Fixes #24196

- - - - -
c5b4efd3 by Zubin Duggal at 2023-12-08T05:48:30-05:00
testsuite: Skip MultiLayerModulesTH_OneShot on darwin

See #24177

- - - - -
fae472a9 by Wendao Lee at 2023-12-08T05:49:12-05:00
docs(Data.Char):Add more detailed descriptions for some functions

Related changed function's docs:

-GHC.Unicode.isAlpha
-GHC.Unicode.isPrint
-GHC.Unicode.isAlphaNum

Add more details for what the function will return.

Co-authored-by: Bodigrim <andrew.lelechenko at gmail.com>

- - - - -
ca7510e4 by Malik Ammar Faisal at 2023-12-08T05:49:55-05:00
Fix float parsing in GHC Cmm Lexer

Add test case for bug #24224

- - - - -
d8baa1bd by Simon Peyton Jones at 2023-12-08T15:40:37+00:00
Take care when simplifying unfoldings

This MR fixes a very subtle bug exposed by #24242.

See Note [Environment for simplLetUnfolding].

I also updated a bunch of Notes on shadowing

- - - - -
03ca551d by Simon Peyton Jones at 2023-12-08T15:54:50-05:00
Comments only in FloatIn

Relevant to #3458

- - - - -
50c78779 by Simon Peyton Jones at 2023-12-08T15:54:50-05:00
Comments only in SpecConstr

- - - - -
9431e195 by Simon Peyton Jones at 2023-12-08T15:54:50-05:00
Add test for #22238

- - - - -
d9e4c597 by Vladislav Zavialov at 2023-12-11T04:19:34-05:00
Make forall a keyword (#23719)

Before this change, GHC used to accept `forall` as a term-level
identifier:

	-- from constraints-0.13
	forall :: forall p. (forall a. Dict (p a)) -> Dict (Forall p)
	forall d = ...

Now it is a parse error.

The -Wforall-identifier warning has served its purpose and is now
a deprecated no-op.

- - - - -
58d56644 by Zubin Duggal at 2023-12-11T04:20:10-05:00
driver: Ensure we actually clear the interactive context before reloading

Previously we called discardIC, but immediately after set the session
back to an old HscEnv that still contained the IC

Partially addresses #24107
Fixes #23405

- - - - -
8e5745a0 by Zubin Duggal at 2023-12-11T04:20:10-05:00
driver: Ensure we force the lookup of old build artifacts before returning the build plan

This prevents us from retaining all previous build artifacts in memory until a
recompile finishes, instead only retaining the exact artifacts we need.

Fixes #24118

- - - - -
105c370c by Zubin Duggal at 2023-12-11T04:20:10-05:00
testsuite: add test for #24118 and #24107

MultiLayerModulesDefsGhci was not able to catch the leak because it uses
:l which discards the previous environment.

Using :r catches both of these leaks

- - - - -
e822ff88 by Zubin Duggal at 2023-12-11T04:20:10-05:00
compiler: Add some strictness annotations to ImportSpec and related constructors
This prevents us from retaining entire HscEnvs.

Force these ImportSpecs when forcing the GlobalRdrEltX

Adds an NFData instance for Bag

Fixes #24107

- - - - -
522c12a4 by Zubin Duggal at 2023-12-11T04:20:10-05:00
compiler: Force IfGlobalRdrEnv in NFData instance.

- - - - -
188b280d by Arnaud Spiwack at 2023-12-11T15:33:31+01:00
LinearTypes => MonoLocalBinds

- - - - -
8e0446df by Arnaud Spiwack at 2023-12-11T15:44:28+01:00
Linear let and where bindings

For expediency, the initial implementation of linear types in GHC
made it so that let and where binders would always be considered
unrestricted. This was rather unpleasant, and probably a big obstacle
to adoption. At any rate, this was not how the proposal was designed.

This patch fixes this infelicity. It was surprisingly difficult to
build, which explains, in part, why it took so long to materialise.

As of this patch, let or where bindings marked with %1 will be
linear (respectively %p for an arbitrary multiplicity p). Unmarked let
will infer their multiplicity.

Here is a prototypical example of program that used to be rejected and
is accepted with this patch:

```haskell
f :: A %1 -> B
g :: B %1 -> C

h :: A %1 -> C
h x = g y
  where
    y = f x
```

Exceptions:
- Recursive let are unrestricted, as there isn't a clear semantics of
  what a linear recursive binding would be.
- Destructive lets with lazy bindings are unrestricted, as their
  desugaring isn't linear (see also #23461).
- (Strict) destructive lets with inferred polymorphic type are
  unrestricted. Because the desugaring isn't linear (See #18461
  down-thread).

Closes #18461 and #18739

Co-authored-by: @jackohughes

- - - - -
effa7e2d by Matthew Craven at 2023-12-12T04:37:20-05:00
Introduce `dataToTagSmall#` primop (closes #21710)

...and use it to generate slightly better code when dataToTag#
is used at a "small data type" where there is no need to mess
with "is_too_big_tag" or potentially look at an info table.

Metric Decrease:
    T18304

- - - - -
35c7aef6 by Matthew Craven at 2023-12-12T04:37:20-05:00
Fix formatting of Note [alg-alt heap check]

- - - - -
7397c784 by Oleg Grenrus at 2023-12-12T04:37:56-05:00
Allow untyped brackets in typed splices and vice versa.

Resolves #24190

Apparently the check was essentially always (as far as I can trace back: d0d47ba76f8f0501cf3c4966bc83966ab38cac27),
and while it does catch some mismatches, the type-checker will catch
them too. OTOH, it prevents writing completely reasonable programs.

- - - - -
a3ee3b99 by Moritz Angermann at 2023-12-12T19:50:58-05:00
Drop hard Xcode dependency

XCODE_VERSION calls out to `xcodebuild`, which is only available
when having `Xcode` installed. The CommandLineTools are not
sufficient. To install Xcode, you must have an apple id to download
the Xcode.xip from apple.

We do not use xcodebuild anywhere in our build explicilty. At best
it appears to be a proxy for checking the linker or the compiler.
These should rather be done with
```
xcrun ld -version
```
or similar, and not by proxy through Xcode. The CLR should be
sufficient for building software on macOS.

- - - - -
1c9496e0 by Vladislav Zavialov at 2023-12-12T19:51:34-05:00
docs: update information on RequiredTypeArguments

Update the User's Guide and Release Notes to account for the recent
progress in the implementation of RequiredTypeArguments.

- - - - -
d0b17576 by Ben Gamari at 2023-12-13T06:33:37-05:00
rts/eventlog: Fix off-by-one in assertion

Previously we failed to account for the NULL terminator `postString`
asserted that there is enough room in the buffer for the string.

- - - - -
a10f9b9b by Ben Gamari at 2023-12-13T06:33:37-05:00
rts/eventlog: Honor result of ensureRoomForVariableEvent is

Previously we would keep plugging along, even if isn't enough room for
the event.

- - - - -
0e0f41c0 by Ben Gamari at 2023-12-13T06:33:37-05:00
rts/eventlog: Avoid truncating event sizes

Previously ensureRoomForVariableEvent would truncate the desired size to
16-bits, resulting in #24197.

Fixes #24197.

- - - - -
64e724c8 by Artin Ghasivand at 2023-12-13T06:34:20-05:00
Remove the "Derived Constraint" argument of TcPluginSolver, docs

- - - - -
fe6d97dd by Vladislav Zavialov at 2023-12-13T06:34:56-05:00
EPA: Move tokens into GhcPs extension fields (#23447)

Summary of changes

* Remove Language.Haskell.Syntax.Concrete
* Move all tokens into GhcPs extension fields (LHsToken -> EpToken)
* Create new TTG extension fields as needed
* Drop the MultAnn wrapper

Updates the haddock submodule.

Co-authored-by: Alan Zimmerman <alan.zimm at gmail.com>

- - - - -
8106e695 by Zubin Duggal at 2023-12-13T06:35:34-05:00
testsuite: use copy_files in T23405

This prevents the tree from being dirtied when the file is modified.

- - - - -
ed0e4099 by Bryan Richter at 2023-12-14T04:30:53-05:00
Document ghc package's PVP-noncompliance

This changes nothing, it just makes the status quo explicit.

- - - - -
8bef8d9f by Luite Stegeman at 2023-12-14T04:31:33-05:00
JS: Mark spurious CI failures js_fragile(24259)

This marks the spurious test failures on the JS platform as
js_fragile(24259), so we don't hold up merge requests while
fixing the underlying issues.

See #24259

- - - - -
1c79526a by Finley McIlwaine at 2023-12-15T12:24:40-08:00
Late plugins

- - - - -
000c3302 by Finley McIlwaine at 2023-12-15T12:24:40-08:00
withTiming on LateCCs and late plugins

- - - - -
be4551ac by Finley McIlwaine at 2023-12-15T12:24:40-08:00
add test for late plugins

- - - - -
7c29da9f by Finley McIlwaine at 2023-12-15T12:24:40-08:00
Document late plugins

- - - - -
9a52ae46 by Ben Gamari at 2023-12-20T07:07:26-05:00
Fix thunk update ordering

Previously we attempted to ensure soundness of concurrent thunk update
by synchronizing on the access of the thunk's info table pointer field.
This was believed to be sufficient since the indirectee (which may
expose a closure allocated by another core) would not be examined
until the info table pointer update is complete.

However, it turns out that this can result in data races in the presence
of multiple threads racing a update a single thunk. For instance,
consider this interleaving under the old scheme:

            Thread A                             Thread B
            ---------                            ---------
    t=0     Enter t
      1     Push update frame
      2     Begin evaluation

      4     Pause thread
      5     t.indirectee=tso
      6     Release t.info=BLACKHOLE

      7     ... (e.g. GC)

      8     Resume thread
      9     Finish evaluation
      10    Relaxed t.indirectee=x

      11                                         Load t.info
      12                                         Acquire fence
      13                                         Inspect t.indirectee

      14    Release t.info=BLACKHOLE

Here Thread A enters thunk `t` but is soon paused, resulting in `t`
being lazily blackholed at t=6. Then, at t=10 Thread A finishes
evaluation and updates `t.indirectee` with a relaxed store.

Meanwhile, Thread B enters the blackhole. Under the old scheme this
would introduce an acquire-fence but this would only synchronize with
Thread A at t=6. Consequently, the result of the evaluation, `x`, is not
visible to Thread B, introducing a data race.

We fix this by treating the `indirectee` field as we do all other
mutable fields. This means we must always access this field with
acquire-loads and release-stores.

See #23185.

- - - - -
f4b53538 by Vladislav Zavialov at 2023-12-20T07:08:02-05:00
docs: Fix link to 051-ghc-base-libraries.rst

The proposal is no longer available at the previous URL.

- - - - -
f7e21fab by Matthew Pickering at 2023-12-21T14:57:40+00:00
hadrian: Build all executables in bin/ folder

In the end the bindist creation logic copies them all into the bin
folder. There is no benefit to building a specific few binaries in the
lib/bin folder anymore.

This also removes the ad-hoc logic to copy the touchy and unlit
executables from stage0 into stage1. It takes <1s to build so we might
as well just build it.

- - - - -
0038d052 by Zubin Duggal at 2023-12-22T23:28:00-05:00
testsuite: mark jspace as fragile on i386.

This test has been flaky for some time and has been failing consistently on
i386-linux since 8e0446df landed.

See #24261

- - - - -
dfd670a0 by Ben Bellick at 2023-12-24T10:10:31-05:00
Deprecate -ddump-json and introduce -fdiagnostics-as-json

Addresses #19278

This commit deprecates the underspecified -ddump-json flag and
introduces a newer, well-specified flag -fdiagnostics-as-json.

Also included is a JSON schema as part of the documentation.

The -ddump-json flag will be slated for removal shortly after this merge.

- - - - -
609e6225 by Ben Bellick at 2023-12-24T10:10:31-05:00
Deprecate -ddump-json and introduce -fdiagnostics-as-json

Addresses #19278

This commit deprecates the underspecified -ddump-json flag and
introduces a newer, well-specified flag -fdiagnostics-as-json.

Also included is a JSON schema as part of the documentation.

The -ddump-json flag will be slated for removal shortly after this merge.

- - - - -
865513b2 by Ömer Sinan Ağacan at 2023-12-24T10:11:13-05:00
Fix BNF in user manual 6.6.8.2: formal syntax for instance declarations

- - - - -
c247b6be by Zubin Duggal at 2023-12-25T16:01:23-05:00
docs: document permissibility of -XOverloadedLabels (#24249)

Document the permissibility introduced by
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0170-unrestricted-overloadedlabels.rst

- - - - -
e5b7eb59 by Ömer Sinan Ağacan at 2023-12-25T16:02:03-05:00
Fix a code block syntax in user manual sec. 6.8.8.6

- - - - -
2db11c08 by Ben Gamari at 2023-12-29T15:35:48-05:00
genSym: Reimplement via CAS on 32-bit platforms

Previously the remaining use of the C implementation on 32-bit platforms
resulted in a subtle bug, #24261. This was due to the C object (which
used the RTS's `atomic_inc64` macro) being compiled without `-threaded`
yet later being used in a threaded compiler.

Side-step this issue by using the pure Haskell `genSym` implementation on
all platforms. This required implementing `fetchAddWord64Addr#` in terms
of CAS on 64-bit platforms.

- - - - -
19328a8c by Xiaoyan Ren at 2023-12-29T15:36:30-05:00
Do not color the diagnostic code in error messages (#24172)

- - - - -
685b467c by Krzysztof Gogolewski at 2023-12-29T15:37:06-05:00
Enforce that bindings of implicit parameters are lifted

Fixes #24298

- - - - -
bc4d67b7 by Matthew Craven at 2023-12-31T06:15:42-05:00
StgToCmm: Detect some no-op case-continuations

...and generate no code for them. Fixes #24264.

- - - - -
5b603139 by Krzysztof Gogolewski at 2023-12-31T06:16:18-05:00
Revert "testsuite: mark jspace as fragile on i386."

This reverts commit 0038d052c8c80b4b430bb2aa1c66d5280be1aa95.

The atomicity bug should be fixed by !11802.

- - - - -
d55216ad by Krzysztof Gogolewski at 2024-01-01T12:05:49-05:00
Refactor: store [[PrimRep]] rather than [Type] in STG

StgConApp stored a list of types. This list was used exclusively
during unarisation of unboxed sums (mkUbxSum).
However, this is at a wrong level of abstraction:
STG shouldn't be concerned with Haskell types, only PrimReps.
Update the code to store a [[PrimRep]]. Also, there's no point in storing
this list when we're not dealing with an unboxed sum.

- - - - -
8b340bc7 by Ömer Sinan Ağacan at 2024-01-01T12:06:29-05:00
Kind signatures docs: mention that they're allowed in newtypes

- - - - -
989bf8e5 by Zubin Duggal at 2024-01-03T20:08:47-05:00
ci: Ensure we use the correct bindist name for the test artifact when generating
release ghcup metadata

Fixes #24268

- - - - -
89299a89 by Krzysztof Gogolewski at 2024-01-03T20:09:23-05:00
Refactor: remove calls to typePrimRepArgs

The function typePrimRepArgs is just a thin wrapper around
typePrimRep, adding a VoidRep if the list is empty.
However, in StgToByteCode, we were discarding that VoidRep anyway,
so there's no point in calling it.

- - - - -
c7be0c68 by mmzk1526 at 2024-01-03T20:10:07-05:00
Use "-V" for alex version check for better backward compatibility
Fixes #24302.
In recent versions of alex, "-v" is used for "--verbose" instead of "-version".

- - - - -
67dbcc0a by Krzysztof Gogolewski at 2024-01-05T02:07:18-05:00
Fix VoidRep handling in ghci debugger

'go' inside extractSubTerms was giving a bad result given a VoidRep,
attempting to round towards the next multiple of 0.
I don't understand much about the debugger but the code should be better
than it was.

Fixes #24306

- - - - -
90ea574e by Krzysztof Gogolewski at 2024-01-05T02:07:54-05:00
VoidRep-related refactor

* In GHC.StgToByteCode, replace bcIdPrimId with idPrimRep,
  bcIdArgRep with idArgRep, atomPrimRep with stgArgRep1.
  All of them were duplicates.
* In GHC.Stg.Unarise, we were converting a PrimRep to a Type and back to
  PrimRep. Remove the calls to primRepToType and typePrimRep1 which cancel out.
* In GHC.STG.Lint, GHC.StgToCmm, GHC.Types.RepType we were filtering out
  VoidRep from the result of typePrimRep. But typePrimRep never returns
  VoidRep - remove the filtering.

- - - - -
eaf72479 by brian at 2024-01-06T23:03:09-05:00
Add unaligned Addr# primops

Implements CLC proposal #154:
  https://github.com/haskell/core-libraries-committee/issues/154

* add unaligned addr primops

* add tests

* accept tests

* add documentation

* fix js primops

* uncomment in access ops

* use Word64 in tests

* apply suggestions

* remove extra file

* move docs

* remove random options

* use setByteArray# primop

* better naming

* update base-exports test

* add base-exports for other architectures

- - - - -
d471d445 by Krzysztof Gogolewski at 2024-01-06T23:03:47-05:00
Remove VoidRep from PrimRep, introduce PrimOrVoidRep

This introduces

data PrimOrVoidRep = VoidRep | NVRep PrimRep

changes typePrimRep1 to return PrimOrVoidRep, and adds a new function
typePrimRepU to be used when the argument is definitely non-void.
Details in Note [VoidRep] in GHC.Types.RepType.

Fixes #19520

- - - - -
48720a07 by Matthew Craven at 2024-01-08T18:57:36-05:00
Apply Note [Sensitivity to unique increment] to LargeRecord

- - - - -
9e2e180f by Sebastian Graf at 2024-01-08T18:58:13-05:00
Debugging: Add diffUFM for convenient diffing between UniqFMs

- - - - -
948f3e35 by Sebastian Graf at 2024-01-08T18:58:13-05:00
Rename Opt_D_dump_stranal to Opt_D_dump_dmdanal

... and Opt_D_dump_str_signatures to Opt_D_dump_dmd_signatures

- - - - -
4e217e3e by Sebastian Graf at 2024-01-08T18:58:13-05:00
Deprecate -ddump-stranal and -ddump-str-signatures

... and suggest -ddump-dmdanal and -ddump-dmd-signatures instead

- - - - -
6c613c90 by Sebastian Graf at 2024-01-08T18:58:13-05:00
Move testsuite/tests/stranal to testsuite/tests/dmdanal

A separate commit so that the rename is obvious to Git(Lab)

- - - - -
c929f02b by Sebastian Graf at 2024-01-08T18:58:13-05:00
CoreSubst: Stricten `substBndr` and `cloneBndr`

Doing so reduced allocations of `cloneBndr` by about 25%.

```
T9233(normal) ghc/alloc    672,488,656    663,083,216  -1.4% GOOD
T9675(optasm) ghc/alloc    423,029,256    415,812,200  -1.7%

    geo. mean                                          -0.1%
    minimum                                            -1.7%
    maximum                                            +0.1%
```

Metric Decrease:
    T9233

- - - - -
d70d5a3b by Simon Peyton Jones at 2024-01-09T14:08:44+00:00
Several improvements to the handling of coercions

* Make `mkSymCo` and `mkInstCo` smarter
  Fixes #23642

* Fix return role of `SelCo` in the coercion optimiser.
  Fixes #23617

* Make the coercion optimiser `opt_trans_rule` work better for newtypes
  Fixes #23619

- - - - -
f92a976d by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Simplifier improvements

This MR started as: allow the simplifer to do more in one pass,
arising from places I could see the simplifier taking two iterations
where one would do.  But it turned into a larger project, because
these changes unexpectedly made inlining blow up, especially join
points in deeply-nested cases.

The net result is good: a 2% improvement in compile time.  The table
below shows changes over 1%.

The main changes are:

* The SimplEnv now has a seInlineDepth field, which says how deep
  in unfoldings we are.  See Note [Inline depth] in Simplify.Env

* Avoid repeatedly simplifying coercions.
  see Note [Avoid re-simplifying coercions] in Simplify.Iteration
  As you'll see from the Note, this makes use of the seInlineDepth.

* Allow Simplify.Utils.postInlineUnconditionally to inline variables
  that are used exactly once. See Note [Post-inline for single-use things].

* Allow Simplify.Iteration.simplAuxBind to inline used-once things.
  This is another part of Note [Post-inline for single-use things], and
  is really good for reducing simplifier iterations in situations like
      case K e of { K x -> blah }
  wher x is used once in blah.

* Make GHC.Core.SimpleOpt.exprIsConApp_maybe do some simple case
  elimination.  Note [Case elim in exprIsConApp_maybe]

* When making join points, don't do so if the join point is so small
  it will immediately be inlined.  See Note [Duplicating alternatives]

* Do not add an unfolding to a join point at birth.  This is a tricky one
  and has a long Note [Do not add unfoldings to join points at birth]
  It shows up in two places
  - In `mkDupableAlt` do not add an inlining
  - (trickier) In `simplLetUnfolding` don't add an unfolding for a
    fresh join point
  I am not fully satisifed with this, but it works and is well documented.

* Many new or rewritten Notes.  E.g. Note [Avoiding simplifying repeatedly]

I discovered that GHC.HsToCore.Pmc.Solver.Types.trvVarInfo was very
delicately balanced.  It's a small, heavily used, overloaded function
and it's important that it inlines. By a fluke it was before, but at
various times in my journey it stopped doing so.  So I added an INLINE
pragma to it.

Metrics: compile_time/bytes allocated
------------------------------------------------
           CoOpt_Singletons(normal)   -4.3% GOOD
                LargeRecord(normal)  -23.3% GOOD
                  PmSeriesS(normal)   -2.4%
                     T11195(normal)   -1.7%
                     T12227(normal)  -20.0% GOOD
                     T12545(normal)   -5.4%
                 T13253-spj(normal)  -50.7% GOOD
                     T13386(normal)   -5.1% GOOD
                     T14766(normal)   -2.4% GOOD
                     T15164(normal)   -1.7%
                     T15304(normal)   +1.0%
                     T15630(normal)   -7.7%
                    T15630a(normal)          NEW
                     T15703(normal)   -7.5% GOOD
                     T16577(normal)   -5.1% GOOD
                     T17516(normal)   -3.6%
                     T18223(normal)  -16.8% GOOD
                     T18282(normal)   -1.5%
                     T18304(normal)   +1.9%
                    T21839c(normal)   -3.5% GOOD
                      T3064(normal)   -1.5%
                      T5030(normal)  -16.2% GOOD
                   T5321Fun(normal)   -1.6%
                      T6048(optasm)   -2.1% GOOD
                      T8095(normal)   -6.1% GOOD
                      T9630(normal)   -5.1% GOOD
                      WWRec(normal)   -1.6%

                          geo. mean   -2.1%
                          minimum    -50.7%
                          maximum     +1.9%

Metric Decrease:
    CoOpt_Singletons
    LargeRecord
    T12227
    T13253-spj
    T13386
    T14766
    T15703
    T16577
    T18223
    T21839c
    T5030
    T6048
    T8095
    T9630

- - - - -
eaeb30ba by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Improve postInlineUnconditionally

This commit adds two things to postInlineUnconditionally:

1. Do not postInlineUnconditionally join point, ever.
   Doing so does not reduce allocation, which is the main point,
   and with join points that are used a lot it can bloat code.
   See point (1) of Note [Duplicating join points] in
   GHC.Core.Opt.Simplify.Iteration.

2. Do not postInlineUnconditionally a strict (demanded) binding.
   It will not allocate a thunk (it'll turn into a case instead)
   so again the main point of inlining it doesn't hold.  Better
   to check per-call-site.

- - - - -
14138d3f by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Update testsuite output

- - - - -
711645a1 by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Try effect of

* making multi-branch cases not work free (fixes #22423)
* use plan A for dataToTag and tagToEnum

- - - - -
2efe491d by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
More changes

* No floating at all for join points

* Never inline j x = I x
  Example: integerSignum !j = IS (integerSignum# j)
  We want this to inline and then cancel with an enclosing case.
  But it won't if we have changed it to
       integerSignum x = case x of
                            IN a -> IS (...)
                            IS b -> IS (...)
                            IP c -> IS (...)

  This involved changing
  - UnfoldingGuidance to not say always-inline for j x = Ix
  - callSiteInline to inline join points only if there is a real
    benefit
  - ok_to_dup_alt in Simplify.Iteration

* Row back (for now) on changes to GHC.Core.Utils.ExprIsCheap

- - - - -
7913fd32 by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Wibble

- - - - -
a3a5a816 by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Wibble

- - - - -
70e8e29c by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Further wibbles

- - - - -
50b7c655 by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
One more wibble

Don't float an unlifted join point

- - - - -
6edeaa62 by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Small wibbles

The most significant change is to mkSelCo.

- - - - -
33935398 by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Temporarily add -DDEBUG to Coercion.hs

- - - - -
1dda32fe by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Fix a missing zonk in before mkSelCo

- - - - -
60a7a879 by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Wibbles

- - - - -
af734ff7 by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Tickish comment

- - - - -
7b6eaf10 by Simon Peyton Jones at 2024-01-09T14:10:03+00:00
Update for TagToEnumOp changes

- - - - -


23 changed files:

- .gitlab/rel_eng/mk-ghcup-metadata/mk_ghcup_metadata.py
- compiler/GHC/Builtin/PrimOps.hs
- compiler/GHC/Builtin/primops.txt.pp
- compiler/GHC/ByteCode/InfoTable.hs
- compiler/GHC/Cmm/Lexer.x
- compiler/GHC/Cmm/Utils.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/LateCC.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/CSE.hs
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/FloatIn.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Inline.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Monad.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/952576b00b40e70d77ebd92e58e4880b7589db86...7b6eaf1064895ceb97a0ce66bbfb438472e035db

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/952576b00b40e70d77ebd92e58e4880b7589db86...7b6eaf1064895ceb97a0ce66bbfb438472e035db
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/20240109/742d6032/attachment-0001.html>


More information about the ghc-commits mailing list