[Git][ghc/ghc][wip/nested-cpr-2019] 30 commits: Inline `integerDecodeDouble#` and constant-fold `decodeDouble_Int64#` instead

Sebastian Graf gitlab at gitlab.haskell.org
Fri Oct 2 14:18:54 UTC 2020



Sebastian Graf pushed to branch wip/nested-cpr-2019 at Glasgow Haskell Compiler / GHC


Commits:
255f7da3 by Sebastian Graf at 2020-10-02T16:17:38+02:00
Inline `integerDecodeDouble#` and constant-fold `decodeDouble_Int64#` instead

Currently, `integerDecodeDouble#` is known-key so that it can be
recognised in constant folding. But that is very brittle and doesn't
survive worker/wrapper, which we even do for
`NOINLINE` things since #13143.
Also it is a trade-off: The implementation of `integerDecodeDouble#`
allocates an `Integer` box that never cancels aways if we don't inline
it.

Hence we recognise the `decodeDouble_Int64#` primop instead in constant
folding, so that we can inline `integerDecodeDouble#`. As a result,
`integerDecodeDouble#` no longer needs to be known-key.

While doing so, I realised that we don't constant-fold
`decodeFloat_Int#` either, so I also added a RULE for it.

`integerDecodeDouble` is dead, so I deleted it.

Part of #18092. This improves the 32-bit `realToFrac`/`toRational`:

Metric Decrease:
    T10359

- - - - -
09642b18 by Sebastian Graf at 2020-10-02T16:17:38+02:00
Nested CPR

- - - - -
21f4f6a8 by Sebastian Graf at 2020-10-02T16:17:38+02:00
Move tests from stranal to cpranal

- - - - -
dfa71c42 by Sebastian Graf at 2020-10-02T16:17:38+02:00
Accept FacState

- - - - -
dd43149b by Sebastian Graf at 2020-10-02T16:17:38+02:00
Factor Cpr and Termination into a joint lattice

As a result, we don't even have to export Termination from Cpr. Neat!

Also I realised there is a simpler and more sound way to generate and
unleash CPR signatures.

- - - - -
accc7b06 by Sebastian Graf at 2020-10-02T16:17:38+02:00
Consider unboxing effects of WW better and get rid of hack

- - - - -
ffceb656 by Sebastian Graf at 2020-10-02T16:17:38+02:00
stuff

- - - - -
a0a58d44 by Sebastian Graf at 2020-10-02T16:17:38+02:00
A slew of testsuite changes

- - - - -
301fbecc by Sebastian Graf at 2020-10-02T16:17:38+02:00
Fix T1600

- - - - -
5d686400 by Sebastian Graf at 2020-10-02T16:17:38+02:00
Fix primop termination

- - - - -
cc60de43 by Sebastian Graf at 2020-10-02T16:17:38+02:00
Test for DataCon wrapper CPR

- - - - -
77a08dea by Sebastian Graf at 2020-10-02T16:17:38+02:00
Fix CPR of bottoming functions/primops

- - - - -
d0c371db by Sebastian Graf at 2020-10-02T16:17:38+02:00
Fix DataConWrapperCpr and accept other test outputs

- - - - -
abb7a677 by Sebastian Graf at 2020-10-02T16:17:38+02:00
Accept two more changed test outputs

- - - - -
57a1ddea by Sebastian Graf at 2020-10-02T16:17:38+02:00
Update CaseBinderCPR with a new function

- - - - -
0882d7a1 by Sebastian Graf at 2020-10-02T16:17:38+02:00
Don't give the case binder the CPR property

- - - - -
adab24ea by Sebastian Graf at 2020-10-02T16:17:38+02:00
Prune CPR sigs to constant depth on all bindings

- - - - -
f21d25cf by Sebastian Graf at 2020-10-02T16:17:39+02:00
Use variable length coding for ConTags

- - - - -
fddeca22 by Sebastian Graf at 2020-10-02T16:17:39+02:00
Accept testuite output

- - - - -
f36591b7 by Sebastian Graf at 2020-10-02T16:17:39+02:00
Don't attach CPR sigs to expandable bindings; transform their unfoldings instead

- - - - -
b65459f7 by Sebastian Graf at 2020-10-02T16:17:39+02:00
Revert "Don't give the case binder the CPR property"

This reverts commit 910edd76d5fe68b58c74f3805112f9faef4f2788.

It seems we broke too much with this change. We lost our big win in
`fish`.

- - - - -
9272dc2b by Sebastian Graf at 2020-10-02T16:17:39+02:00
A more modular and configurable approach to optimistic case binder CPR

- - - - -
295251f3 by Sebastian Graf at 2020-10-02T16:17:39+02:00
Fix T9291

- - - - -
5a7d9758 by Sebastian Graf at 2020-10-02T16:17:39+02:00
Document -fcase-binder-cpr-depth in the user's guide

- - - - -
f31e09ad by Sebastian Graf at 2020-10-02T16:17:39+02:00
Testsuite changes

- - - - -
fe784c0a by Sebastian Graf at 2020-10-02T16:17:39+02:00
Refactoring around cprAnalBind

- - - - -
f274b8fb by Sebastian Graf at 2020-10-02T16:17:39+02:00
Fix case binder CPR by not looking into unfoldings of case binders

- - - - -
b013bbed by Sebastian Graf at 2020-10-02T16:17:39+02:00
Regard all arity 0 bindings (incl. DataCon apps) as thunks

- - - - -
e8241350 by Sebastian Graf at 2020-10-02T16:17:39+02:00
Don't store CPR info for data structures that are NOINLINE

- - - - -
e41b7ed8 by Sebastian Graf at 2020-10-02T16:17:39+02:00
Accepting metric changes to advance CI

There are two ghc/alloc increases, which we might want to investigate
later on.

Metric Decrease:
    T9872a
    T9872b
    T9872c
Metric Increase:
    T13253
    T13701

- - - - -


30 changed files:

- compiler/GHC/Builtin/Names.hs
- compiler/GHC/Core/Make.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/ConstantFold.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/SetLevels.hs
- compiler/GHC/Core/Opt/Simplify.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/CoreToIface.hs
- compiler/GHC/Data/Maybe.hs
- compiler/GHC/Driver/Flags.hs
- compiler/GHC/Driver/Session.hs
- compiler/GHC/Iface/Syntax.hs
- compiler/GHC/Iface/Tidy.hs
- compiler/GHC/Types/Cpr.hs
- compiler/GHC/Types/Demand.hs
- compiler/GHC/Types/Id/Info.hs
- compiler/GHC/Types/Id/Make.hs
- docs/users_guide/using-optimisation.rst
- − libraries/ghc-bignum/gmp/gmp-tarballs
- libraries/ghc-bignum/src/GHC/Num/Integer.hs
- testsuite/tests/stranal/sigs/CaseBinderCPR.hs → testsuite/tests/cpranal/sigs/CaseBinderCPR.hs
- + testsuite/tests/cpranal/sigs/CaseBinderCPR.stderr
- testsuite/tests/stranal/sigs/FacState.hs → testsuite/tests/cpranal/sigs/FacState.hs
- + testsuite/tests/cpranal/sigs/FacState.stderr
- + testsuite/tests/cpranal/sigs/Makefile
- testsuite/tests/stranal/should_compile/T10694.hs → testsuite/tests/cpranal/sigs/T10694.hs
- + testsuite/tests/cpranal/sigs/T10694.stderr
- + testsuite/tests/cpranal/sigs/T1600.hs


The diff was not included because it is too large.


View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c7e6705fb267ad71b16865ad01d0e8ac2694d90d...e41b7ed81ed0bf953b01ca7fff7e39d827238e33

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/c7e6705fb267ad71b16865ad01d0e8ac2694d90d...e41b7ed81ed0bf953b01ca7fff7e39d827238e33
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/20201002/1d59ce1d/attachment.html>


More information about the ghc-commits mailing list