<!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>
Simon Peyton Jones pushed to branch wip/T18412
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/9ad072b487fe528947f817b0417933a6cd1941b7">9ad072b4</a></strong>
<div>
<span>by Simon Peyton Jones</span>
<i>at 2020-07-13T14:52:49-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Use dumpStyle when printing inlinings

This just makes debug-printing consistent,
and more informative.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/e78c4efb8735eb97f17e7b4ca35e305b0766f78a">e78c4efb</a></strong>
<div>
<span>by Simon Peyton Jones</span>
<i>at 2020-07-13T14:52:49-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Comments only
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/7ccb760b1a8034b28171d7540712fd195f65d1fd">7ccb760b</a></strong>
<div>
<span>by Simon Peyton Jones</span>
<i>at 2020-07-13T14:52:49-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Reduce result discount in conSize

Ticket #18282 showed that the result discount given by conSize
was massively too large.  This patch reduces that discount to
a constant 10, which just balances the cost of the constructor
application itself.

Note [Constructor size and result discount] elaborates, as
does the ticket #18282.

Reducing result discount reduces inlining, which affects perf.  I
found that I could increase the unfoldingUseThrehold from 80 to 90 in
compensation; in combination with the result discount change I get
these overall nofib numbers:

        Program           Size    Allocs   Runtime   Elapsed  TotalMem
--------------------------------------------------------------------------------
          boyer          -0.2%     +5.4%     -3.2%     -3.4%      0.0%
       cichelli          -0.1%     +5.9%    -11.2%    -11.7%      0.0%
      compress2          -0.2%     +9.6%     -6.0%     -6.8%      0.0%
   cryptarithm2          -0.1%     -3.9%     -6.0%     -5.7%      0.0%
         gamteb          -0.2%     +2.6%    -13.8%    -14.4%      0.0%
         genfft          -0.1%     -1.6%    -29.5%    -29.9%      0.0%
             gg          -0.0%     -2.2%    -17.2%    -17.8%    -20.0%
           life          -0.1%     -2.2%    -62.3%    -63.4%      0.0%
           mate          +0.0%     +1.4%     -5.1%     -5.1%    -14.3%
         parser          -0.2%     -2.1%     +7.4%     +6.7%      0.0%
      primetest          -0.2%    -12.8%    -14.3%    -14.2%      0.0%
         puzzle          -0.2%     +2.1%    -10.0%    -10.4%      0.0%
            rsa          -0.2%    -11.7%     -3.7%     -3.8%      0.0%
         simple          -0.2%     +2.8%    -36.7%    -38.3%     -2.2%
   wheel-sieve2          -0.1%    -19.2%    -48.8%    -49.2%    -42.9%
--------------------------------------------------------------------------------
            Min          -0.4%    -19.2%    -62.3%    -63.4%    -42.9%
            Max          +0.3%     +9.6%     +7.4%    +11.0%    +16.7%
 Geometric Mean          -0.1%     -0.3%    -17.6%    -18.0%     -0.7%

I'm ok with these numbers, remembering that this change removes
an *exponential* increase in code size in some in-the-wild cases.

I investigated compress2.  The difference is entirely caused by this
function no longer inlining

WriteRoutines.$woutputCodes
  = \ (w :: [CodeEvent]) ->
      let result_s1Sr
            = case WriteRoutines.outputCodes_$s$woutput w 0# 0# 8# 9# of
                (# ww1, ww2 #) -> (ww1, ww2)
      in (# case result_s1Sr of (x, _) ->
              map @Int @Char WriteRoutines.outputCodes1 x
         , case result_s1Sr of { (_, y) -> y } #)

It was right on the cusp before, driven by the excessive result
discount.  Too bad!

Happily, the compiler/perf tests show a number of improvements:
    T12227     compiler bytes-alloc  -6.6%
    T12545     compiler bytes-alloc  -4.7%
    T13056     compiler bytes-alloc  -3.3%
    T15263     runtime  bytes-alloc -13.1%
    T17499     runtime  bytes-alloc -14.3%
    T3294      compiler bytes-alloc  -1.1%
    T5030      compiler bytes-alloc -11.7%
    T9872a     compiler bytes-alloc  -2.0%
    T9872b     compiler bytes-alloc  -1.2%
    T9872c     compiler bytes-alloc  -1.5%

Metric Decrease:
    T12227
    T12545
    T13056
    T15263
    T17499
    T3294
    T5030
    T9872a
    T9872b
    T9872c
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/7f0b671ee8a65913891c07f157b21d77d6c63036">7f0b671e</a></strong>
<div>
<span>by Ben Gamari</span>
<i>at 2020-07-13T14:52:49-04:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">testsuite: Widen acceptance threshold on T5837

This test is positively tiny and consequently the bytes allocated
measurement will be relatively noisy. Consequently I have seen this
fail spuriously quite often.
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/52f28cd653f092d4e2e33b37135799bf5068d2c3">52f28cd6</a></strong>
<div>
<span>by Simon Peyton Jones</span>
<i>at 2020-07-14T16:47:35+01:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Allow multiple case branches to have a higher rank type

As #18412 points out, it should be OK for multiple case alternatives
to have a higher rank type, provided they are all the same.

This patch implements that change.  It sweeps away
GHC.Tc.Gen.Match.tauifyMultipleBranches, and friends, replacing it
with an enhanced version of fillInferResult.

The basic change to fillInferResult is to permit the case in which
another case alternative has already filled in the result; and in
that case simply unify.  It's very simple actually.

See the new Note [fillInferResult] in TcMType

Other refactoring:

- Move all the InferResult code to one place, in GHC.Tc.Utils.TcMType
  (previously some of it was in Unify)

- Move tcInstType and friends from TcMType to Instantiate, where it
  more properly belongs.  (TCMType was getting very long.)
</pre>
</li>
<li>
<strong><a href="https://gitlab.haskell.org/ghc/ghc/-/commit/20037a90d0a8a24a5dc31603cd2374f769e4f109">20037a90</a></strong>
<div>
<span>by Simon Peyton Jones</span>
<i>at 2020-07-14T16:47:35+01:00</i>
</div>
<pre class="commit-message" style="white-space: pre-wrap; margin: 0;">Improve typechecking of NPlusK patterns

This patch (due to Richard Eisenberg) improves
documentation of the wrapper returned by tcSubMult
(see Note [Wrapper returned from tcSubMult] in
 GHC.Tc.Utils.Unify).

And, more substantially, it cleans up the multiplicity
handling in the typechecking of NPlusKPat
</pre>
</li>
</ul>
<h4>30 changed files:</h4>
<ul>
<li class="file-stats">
<a href="#f168a93cde5e2aec2441d6331dfe500172df4af3">
compiler/GHC/Core/Opt/Simplify.hs
</a>
</li>
<li class="file-stats">
<a href="#578c7c3857d66d963736ff6742f3433a0e8d01b7">
compiler/GHC/Core/TyCo/Rep.hs
</a>
</li>
<li class="file-stats">
<a href="#84c9d3ba34173297e7d7747e02caa2e004b164fc">
compiler/GHC/Core/Type.hs
</a>
</li>
<li class="file-stats">
<a href="#2811a7297b8aa206197ac1f5dabd0818e3c7ec5a">
compiler/GHC/Core/Unfold.hs
</a>
</li>
<li class="file-stats">
<a href="#f157d5c316465070f94641e4c9ab0248311588cd">
compiler/GHC/Core/UsageEnv.hs
</a>
</li>
<li class="file-stats">
<a href="#774d88050336ef660c7a219fb06c480c2fc639bc">
compiler/GHC/Driver/Session.hs
</a>
</li>
<li class="file-stats">
<a href="#65e2067fbb7377818b6cadff0531f44029499948">
compiler/GHC/HsToCore/Binds.hs
</a>
</li>
<li class="file-stats">
<a href="#902811828741e6bcd64702935bbb54edbbd070ef">
compiler/GHC/Tc/Gen/Expr.hs
</a>
</li>
<li class="file-stats">
<a href="#3377164bfe9a1f1a8cfd588703ae1e0ea1e91cf9">
compiler/GHC/Tc/Gen/Match.hs
</a>
</li>
<li class="file-stats">
<a href="#3ee8be814b6c6727880deab3772e6af922524bf0">
compiler/GHC/Tc/Gen/Pat.hs
</a>
</li>
<li class="file-stats">
<a href="#eade747fa0a15693c67617629e286714fce958e4">
compiler/GHC/Tc/Gen/Sig.hs
</a>
</li>
<li class="file-stats">
<a href="#aebe2c3d616f6843166d2657bed048898add6bc9">
compiler/GHC/Tc/Instance/Class.hs
</a>
</li>
<li class="file-stats">
<a href="#07389a8f0516c26409d86f6bb651ed00759b5d4c">
compiler/GHC/Tc/Instance/Family.hs
</a>
</li>
<li class="file-stats">
<a href="#81707f1fe21087531cefd70879aa09c2be5c1d22">
compiler/GHC/Tc/Solver/Flatten.hs
</a>
</li>
<li class="file-stats">
<a href="#dd8bbe6a21866e4f574f4796b7ad19de17564072">
compiler/GHC/Tc/TyCl/Class.hs
</a>
</li>
<li class="file-stats">
<a href="#46e7b59eca287d43c19d0d8902b41f5d04f0d268">
compiler/GHC/Tc/Types/Evidence.hs
</a>
</li>
<li class="file-stats">
<a href="#f021c52a6ccf306e88c9f760b2aee33b180ba341">
compiler/GHC/Tc/Utils/Env.hs
</a>
</li>
<li class="file-stats">
<a href="#59d42d45d27a766c3ef299d73c226697153b7f6e">
compiler/GHC/Tc/Utils/Instantiate.hs
</a>
</li>
<li class="file-stats">
<a href="#94c96afe1bb3b771ffbcfeeca34ce43ebbe76ccb">
compiler/GHC/Tc/Utils/TcMType.hs
</a>
</li>
<li class="file-stats">
<a href="#5461e7beeb7ae73d7c01f720cbaa3fa2c5333590">
compiler/GHC/Tc/Utils/TcType.hs
</a>
</li>
<li class="file-stats">
<a href="#74295edeac870ee7f2f3484ebaffab5c948b735a">
compiler/GHC/Tc/Utils/Unify.hs
</a>
</li>
<li class="file-stats">
<a href="#b74ba5875fd7cccd72bb96f5e09ffd324e58a963">
testsuite/tests/deSugar/should_compile/T13208.stdout
</a>
</li>
<li class="file-stats">
<a href="#941cab631058a932f5b548d7ef1ec5735a95df46">
testsuite/tests/deSugar/should_compile/T16615.stderr
</a>
</li>
<li class="file-stats">
<a href="#3fa1c31577a138583da8f797e3719b53c0247443">
testsuite/tests/dependent/should_compile/dynamic-paper.stderr
</a>
</li>
<li class="file-stats">
<a href="#73459bdd68c8a1d83dd2fc05500d4d379b541a3d">
testsuite/tests/numeric/should_compile/T14170.stdout
</a>
</li>
<li class="file-stats">
<a href="#68981928c0d335390bba962b95dc1104a8881d05">
testsuite/tests/numeric/should_compile/T14465.stdout
</a>
</li>
<li class="file-stats">
<a href="#e6a25af732cafed9cd91b716ddbdb29b303bd865">
testsuite/tests/numeric/should_compile/T7116.stdout
</a>
</li>
<li class="file-stats">
<a href="#ec1e5d16b27c7ff3995d36d70de8719cad4fc9e6">
<span class="new-file">
+
testsuite/tests/perf/compiler/T18282.hs
</span>
</a>
</li>
<li class="file-stats">
<a href="#fd4a0b65d74153aed8b33b01a04eb3ff7442cd45">
testsuite/tests/perf/compiler/all.T
</a>
</li>
<li class="file-stats">
<a href="#6e2ce964ea02e92c2202946150700a3219beed86">
testsuite/tests/simplCore/should_compile/T13143.stderr
</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: #777;">

<br>
<a href="https://gitlab.haskell.org/ghc/ghc/-/compare/e37cbc69a81f7fc07cb87cd8b3adeab377c3c52b...20037a90d0a8a24a5dc31603cd2374f769e4f109">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>