<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<meta content="text/html; charset=US-ASCII" http-equiv="Content-Type">
<title>
GitLab
</title>



<style>img {
max-width: 100%; height: auto;
}
</style>
</head>
<body>
<div class="content">

<h3>
Sebastian Graf pushed to branch wip/nested-cpr-2019
at <a href="https://gitlab.haskell.org/ghc/ghc">Glasgow Haskell Compiler / GHC</a>
</h3>
<h4>
Commits:
</h4>
<ul>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/34d1c78d0274418c8c229c20252595272ace3680">34d1c78d</a></strong>
<div>
<span>by Sebastian Graf</span>
<i>at 2020-12-17T12:00:22+01:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Nested CPR

Move tests from stranal to cpranal

Accept FacState

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.

Consider unboxing effects of WW better and get rid of hack

stuff

A slew of testsuite changes

Fix T1600

Fix primop termination

Test for DataCon wrapper CPR

Fix CPR of bottoming functions/primops

Fix DataConWrapperCpr and accept other test outputs

Accept two more changed test outputs

Update CaseBinderCPR with a new function

Don't give the case binder the CPR property

Prune CPR sigs to constant depth on all bindings

Use variable length coding for ConTags

Accept testuite output

Don't attach CPR sigs to expandable bindings; transform their unfoldings instead

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`.

A more modular and configurable approach to optimistic case binder CPR

Fix T9291

Document -fcase-binder-cpr-depth in the user's guide

Testsuite changes

Refactoring around cprAnalBind

Fix case binder CPR by not looking into unfoldings of case binders

Fix T16893

Accept new test output for T17673

Accepting metric changes to advance CI

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

Metric Decrease:
    T1969
    T9233
    T9872a
    T9872b
    T9872c
    T9872d
    T12425
    T12545
Metric Increase:
    T13253
    T13701
    T15164
Metric Increase ['max_bytes_used'] (test_env='x86_64-darwin'):
    T9675
Metric Increase ['max_bytes_used'] (test_env='x86_64-linux-deb9-dwarf'):
    T9675
Metric Increase ['max_bytes_used', 'peak_megabytes_allocated']:
    T10370
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/9873fa2ae3e41d6ffc180a05e0e36414006bcffb">9873fa2a</a></strong>
<div>
<span>by Sebastian Graf</span>
<i>at 2020-12-17T14:18:25+01:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">WorkWrap CPR: Consider how a function body is used

Consider `T18894`:

```hs
module T18894 (h) where

g :: Int -> Int -> (Int,Int)
g !m 1 = (2 + m, 0)
g m  n = (2 * m, 2 `div` n)
{-# NOINLINE g #-}

h :: Int -> Int
h 1 = 0
h m
  | odd m     = snd (g m 2)
  | otherwise = uncurry (+) (g 2 m)
```

We give `g` the CPR type `#c1(#c1(*), *c1(#))`. Previously, that
wouldn't let us unbox the second component, because the division
might diverge (throw a div-by-zero exception).

But since #18894/!4493, we annotate `g` with its demand
`UCU(CS(P(1P(U),SP(U))))`.
Note that demand tells us that, *when* `g` is called, we always
evaluate the second component of the returned pair. So it's OK for W/W
to unbox it, because all call sites will force the division anyway!

This is what this commit is implementing. The changes are entirely
local to W/W.

I also added a test case, `T18174`, that tracks everything Nested CPR is
supposed to do (which is tracked in #18174).
</pre>
</li>
</ul>
<h4>30 changed files:</h4>
<ul>
<li class="file-stats">
<a href="#35cff95f9f44690fc50b44bbe8ac3c554c7d5a5e">
compiler/GHC/Core/Make.hs
</a>
</li>
<li class="file-stats">
<a href="#c3967bb9d3e8f5aae2dd111b5a335b48c21c1999">
compiler/GHC/Core/Opt/Arity.hs
</a>
</li>
<li class="file-stats">
<a href="#c1bf6b849619bc8d7ef37a97d993dbfaa9966f7b">
compiler/GHC/Core/Opt/CprAnal.hs
</a>
</li>
<li class="file-stats">
<a href="#cc763cdd1967f5d921161a32f64136cfcf0332c5">
compiler/GHC/Core/Opt/SetLevels.hs
</a>
</li>
<li class="file-stats">
<a href="#f168a93cde5e2aec2441d6331dfe500172df4af3">
compiler/GHC/Core/Opt/Simplify.hs
</a>
</li>
<li class="file-stats">
<a href="#5b215b0e109123e4bef5434854f18e2f61c45b88">
compiler/GHC/Core/Opt/WorkWrap.hs
</a>
</li>
<li class="file-stats">
<a href="#f4421b4e35592648510c877ecf55b1af2b96dcee">
compiler/GHC/Core/Opt/WorkWrap/Utils.hs
</a>
</li>
<li class="file-stats">
<a href="#bbf06eb5d4f0db7bc3213b84b9f5822710ff7be8">
compiler/GHC/CoreToIface.hs
</a>
</li>
<li class="file-stats">
<a href="#f4ae6618b39d5ee4af8302b821aa7e38097a84b7">
compiler/GHC/Data/Maybe.hs
</a>
</li>
<li class="file-stats">
<a href="#2e5692f568fd7b67a6b172e2a60469da8392508c">
compiler/GHC/Driver/Flags.hs
</a>
</li>
<li class="file-stats">
<a href="#774d88050336ef660c7a219fb06c480c2fc639bc">
compiler/GHC/Driver/Session.hs
</a>
</li>
<li class="file-stats">
<a href="#079d6b28856775716c78fdd4a4b35bb45a59002c">
compiler/GHC/Iface/Syntax.hs
</a>
</li>
<li class="file-stats">
<a href="#d11203a9321005ba51a16d751c86f609d1f18c71">
compiler/GHC/Iface/Tidy.hs
</a>
</li>
<li class="file-stats">
<a href="#657eec52eed3c8be846a0b60eb6088d5f465de8a">
compiler/GHC/Stg/Lift/Analysis.hs
</a>
</li>
<li class="file-stats">
<a href="#5a3376ebe9ef8294e13f1fb3761637fa76cd1558">
compiler/GHC/Types/Cpr.hs
</a>
</li>
<li class="file-stats">
<a href="#d09e98aae6ad2eb59d08eac7894b68c0ab820cda">
compiler/GHC/Types/Demand.hs
</a>
</li>
<li class="file-stats">
<a href="#38110817cdbc9a34d2b80a14070cabc7515c808a">
compiler/GHC/Types/Id/Info.hs
</a>
</li>
<li class="file-stats">
<a href="#261c0c5029eb34eb7436b087d77314f377ff8223">
compiler/GHC/Types/Id/Make.hs
</a>
</li>
<li class="file-stats">
<a href="#2e45f2cd303dd998950a7c8042e796a5b2abd64f">
docs/users_guide/using-optimisation.rst
</a>
</li>
<li class="file-stats">
<a href="#625583b0f83ab4f273b1b3303e3b4060b149bf69">
<span class="new-file">
+
testsuite/tests/cpranal/should_compile/T18174.hs
</span>
</a>
</li>
<li class="file-stats">
<a href="#9b7f3c4da9ed85be1a5417353ef7e1c1b9314965">
<span class="new-file">
+
testsuite/tests/cpranal/should_compile/T18174.stderr
</span>
</a>
</li>
<li class="file-stats">
<a href="#f837bd572684e9613e25f94aeae6ebf7ad96e03c">
testsuite/tests/cpranal/should_compile/all.T
</a>
</li>
<li class="file-stats">
<a href="#2ac98cc8621d6bfdea8f2b4778708fd4cc6b2a43">
testsuite/tests/stranal/sigs/CaseBinderCPR.hs

testsuite/tests/cpranal/sigs/CaseBinderCPR.hs
</a>
</li>
<li class="file-stats">
<a href="#ababeed265656180dcff618bf07f106122a4c488">
<span class="new-file">
+
testsuite/tests/cpranal/sigs/CaseBinderCPR.stderr
</span>
</a>
</li>
<li class="file-stats">
<a href="#43ee12cc363fbd354ba8fe834bc0645da253e571">
testsuite/tests/stranal/sigs/FacState.hs

testsuite/tests/cpranal/sigs/FacState.hs
</a>
</li>
<li class="file-stats">
<a href="#def1a3e69aaf5611b8d113117ba3736904fa8034">
<span class="new-file">
+
testsuite/tests/cpranal/sigs/FacState.stderr
</span>
</a>
</li>
<li class="file-stats">
<a href="#dd093eefcb81a5d889a35fe44f9c2f67acb37513">
<span class="new-file">
+
testsuite/tests/cpranal/sigs/Makefile
</span>
</a>
</li>
<li class="file-stats">
<a href="#798336961fb8c99684cf88b3cdac786a15a8938e">
testsuite/tests/stranal/should_compile/T10694.hs

testsuite/tests/cpranal/sigs/T10694.hs
</a>
</li>
<li class="file-stats">
<a href="#14abb53dfb8f7d74fcd5b2d69e33df3b785bbe7f">
<span class="new-file">
+
testsuite/tests/cpranal/sigs/T10694.stderr
</span>
</a>
</li>
<li class="file-stats">
<a href="#83c51c55db5835fdec38507a4acaaa61da9e39d9">
<span class="new-file">
+
testsuite/tests/cpranal/sigs/T1600.hs
</span>
</a>
</li>
</ul>
<h5>The diff was not included because it is too large.</h5>

</div>
<div class="footer" style="margin-top: 10px;">
<p style="font-size: small; color: #666;">

<br>
<a href="https://gitlab.haskell.org/ghc/ghc/-/compare/4d8a46f0ce883b2611ca8aeb6d4cf35a00c61294...9873fa2ae3e41d6ffc180a05e0e36414006bcffb">View it on GitLab</a>.
<br>
You're receiving this email because of your account on gitlab.haskell.org.
If you'd like to receive fewer emails, you can
adjust your notification settings.



</p>
</div>
</body>
</html>