[Git][ghc/ghc][wip/T23083] 7 commits: Clarify floating of unsafeEqualityProofs (#23754)

Sebastian Graf (@sgraf812) gitlab at gitlab.haskell.org
Tue Aug 8 12:57:26 UTC 2023



Sebastian Graf pushed to branch wip/T23083 at Glasgow Haskell Compiler / GHC


Commits:
b3837e92 by Sebastian Graf at 2023-08-08T14:57:16+02:00
Clarify floating of unsafeEqualityProofs (#23754)

- - - - -
4a6d6cc9 by Sebastian Graf at 2023-08-08T14:57:17+02:00
Kill SetLevel.notWorthFloating.is_triv (#23270)

We have had it since b84ba676034, when it operated on annotated expressions.
Nowadays it operates on vanilla `CoreExpr` though, so we should just call
`exprIsTrivial`; thus handling empty cases and string literals correctly.

- - - - -
1a8d9ce9 by Sebastian Graf at 2023-08-08T14:57:17+02:00
ANFise string literal arguments (#23270)

This instates the invariant that a trivial CoreExpr translates to an atomic
StgExpr. Nice.

Annoyingly, in -O0 we sometimes generate
```
foo = case "blah"# of sat { __DEFAULT -> unpackCString# sat }
```
which makes it a bit harder to spot that we can emit a standard
`stg_unpack_cstring` thunk.

Fixes #23270.

- - - - -
2c5c9ed9 by Sebastian Graf at 2023-08-08T14:57:17+02:00
Deactivate -fcatch-nonexhaustive-cases in ghc-bignum (#23345)

- - - - -
39c352cc by Sebastian Graf at 2023-08-08T14:57:17+02:00
CorePrep: Eliminate EmptyCase and unsafeEqualityProof in CoreToStg instead

We eliminate EmptyCase by way of `coreToStg (Case e _ _ []) = coreToStg e` now.
The main reason is that it plays far better in conjunction with eta expansion
(as we aim to do for arguments in CorePrep, #23083), because we can discard
any arguments, `(case e of {}) eta == case e of {}`, whereas in `(e |> co) eta`
it's impossible to discard the argument.

We do also give the same treatment to unsafeCoerce proofs and treat them as
trivial iff their RHS is trivial.

It is also both much simpler to describe than the previous mechanism of emitting
an unsafe coercion and simpler to implement, removing quite a bit of commentary
and `CorePrepProv`.

- - - - -
3abc564c by Sebastian Graf at 2023-08-08T14:57:17+02:00
CorePrep: Eta expand arguments (#23083)

Previously, we'd only eta expand let bindings and lambdas,
now we'll also eta expand arguments such as in T23083:
```hs
g f h = f (h `seq` (h $))
```
Unless `-fpedantic-bottoms` is set, we'll now transform to
```hs
g f h = f (\eta -> h eta)
```
in CorePrep.

See the new `Note [Eta expansion of arguments in CorePrep]` for the details.

We only do this optimisation with -O2 because we saw 2-3% ghc/alloc regressions
in T4801 and T5321FD.

Fixes #23083.

- - - - -
18bdaa31 by Sebastian Graf at 2023-08-08T14:57:17+02:00
Revert "Bump bytestring submodule to 0.11.5.1"

This reverts commit 43578d60bfc478e7277dcd892463cec305400025.

- - - - -


30 changed files:

- .gitlab-ci.yml
- compiler/GHC/Core.hs
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Coercion/Opt.hs
- compiler/GHC/Core/FVs.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/TyCo/FVs.hs
- compiler/GHC/Core/TyCo/Rep.hs
- compiler/GHC/Core/TyCo/Subst.hs
- compiler/GHC/Core/TyCo/Tidy.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Unfold.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/CoreToStg.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/Driver/Config/CoreToStg/Prep.hs
- compiler/GHC/Driver/DynFlags.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Type.hs
- compiler/GHC/IfaceToCore.hs
- compiler/GHC/StgToCmm/Bind.hs
- compiler/GHC/StgToCmm/Env.hs
- compiler/GHC/StgToCmm/Expr.hs
- compiler/GHC/Tc/TyCl/Utils.hs
- compiler/GHC/Tc/Utils/TcMType.hs
- compiler/GHC/Utils/Binary.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d4b882fecd65deeb8d108e498c9a16245c203856...18bdaa31a8b7e3a981033f1418e9caea3e8fe412

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d4b882fecd65deeb8d108e498c9a16245c203856...18bdaa31a8b7e3a981033f1418e9caea3e8fe412
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/20230808/c718907f/attachment-0001.html>


More information about the ghc-commits mailing list