Skip to content
Snippets Groups Projects
Commit ea9a4ef6 authored by Simon Peyton Jones's avatar Simon Peyton Jones Committed by Marge Bot
Browse files

Avoid useless w/w split, take 2

This commit:

    commit c6faa42b
    Author: Simon Peyton Jones <simonpj@microsoft.com>
    Date:   Mon Mar 9 10:20:42 2020 +0000

    Avoid useless w/w split

    This patch is just a tidy-up for the post-strictness-analysis
    worker wrapper split.  Consider

       f x = x

    Strictnesss analysis does not lead to a w/w split, so the
    obvious thing is to leave it 100% alone.  But actually, because
    the RHS is small, we ended up adding a StableUnfolding for it.

    There is some reason to do this if we choose /not/ do to w/w
    on the grounds that the function is small.  See
    Note [Don't w/w inline small non-loop-breaker things]

    But there is no reason if we would not have done w/w anyway.

    This patch just moves the conditional to later.  Easy.

turns out to have a bug in it.  Instead of /moving/ the conditional,
I /duplicated/ it.  Then in a subsequent unrelated tidy-up
(087ac4eb) I removed the second (redundant) test!

This patch does what I originally intended.

There is also a small refactoring in GHC.Core.Unfold, to make the
code clearer, but with no change in behaviour.

It does, however, have a generally good effect on compile times,
because we aren't dealing with so many silly stable unfoldings.
Here are the non-zero changes:

Metrics: compile_time/bytes allocated
-------------------------------------
                                         Baseline
                     Test    Metric         value     New value Change
---------------------------------------------------------------------------
 ManyAlternatives(normal) ghc/alloc   791969344.0   792665048.0  +0.1%
 ManyConstructors(normal) ghc/alloc  4351126824.0  4358303528.0  +0.2%
        PmSeriesG(normal) ghc/alloc    50362552.0    50482208.0  +0.2%
        PmSeriesS(normal) ghc/alloc    63733024.0    63619912.0  -0.2%
           T10421(normal) ghc/alloc   121224624.0   119695448.0  -1.3% GOOD
          T10421a(normal) ghc/alloc    85256392.0    83714224.0  -1.8%
           T10547(normal) ghc/alloc    29253072.0    29258256.0  +0.0%
           T10858(normal) ghc/alloc   189343152.0   187972328.0  -0.7%
           T11195(normal) ghc/alloc   281208248.0   279727584.0  -0.5%
           T11276(normal) ghc/alloc   141966952.0   142046224.0  +0.1%
          T11303b(normal) ghc/alloc    46228360.0    46259024.0  +0.1%
           T11545(normal) ghc/alloc  2663128768.0  2667412656.0  +0.2%
           T11822(normal) ghc/alloc   138686944.0   138760176.0  +0.1%
           T12227(normal) ghc/alloc   482836000.0   475421056.0  -1.5% GOOD
           T12234(optasm) ghc/alloc    60710520.0    60781808.0  +0.1%
           T12425(optasm) ghc/alloc   104089000.0   104022424.0  -0.1%
           T12545(normal) ghc/alloc  1711759416.0  1705711528.0  -0.4%
           T12707(normal) ghc/alloc   991541120.0   991921776.0  +0.0%
           T13035(normal) ghc/alloc   108199872.0   108370704.0  +0.2%
           T13056(optasm) ghc/alloc   414642544.0   412580384.0  -0.5%
           T13253(normal) ghc/alloc   361701272.0   355838624.0  -1.6%
       T13253-spj(normal) ghc/alloc   157710168.0   157397768.0  -0.2%
           T13379(normal) ghc/alloc   370984400.0   371345888.0  +0.1%
           T13701(normal) ghc/alloc  2439764144.0  2441351984.0  +0.1%
             T14052(ghci) ghc/alloc  2154090896.0  2156671400.0  +0.1%
           T15164(normal) ghc/alloc  1478517688.0  1440317696.0  -2.6% GOOD
           T15630(normal) ghc/alloc   178053912.0   172489808.0  -3.1%
           T16577(normal) ghc/alloc  7859948896.0  7854524080.0  -0.1%
           T17516(normal) ghc/alloc  1271520128.0  1202096488.0  -5.5% GOOD
           T17836(normal) ghc/alloc  1123320632.0  1123922480.0  +0.1%
          T17836b(normal) ghc/alloc    54526280.0    54576776.0  +0.1%
          T17977b(normal) ghc/alloc    42706752.0    42730544.0  +0.1%
           T18140(normal) ghc/alloc   108834568.0   108693816.0  -0.1%
           T18223(normal) ghc/alloc  5539629264.0  5579500872.0  +0.7%
           T18304(normal) ghc/alloc    97589720.0    97196944.0  -0.4%
           T18478(normal) ghc/alloc   770755472.0   771232888.0  +0.1%
          T18698a(normal) ghc/alloc   408691160.0   374364992.0  -8.4% GOOD
          T18698b(normal) ghc/alloc   492419768.0   458809408.0  -6.8% GOOD
           T18923(normal) ghc/alloc    72177032.0    71368824.0  -1.1%
            T1969(normal) ghc/alloc   803523496.0   804655112.0  +0.1%
            T3064(normal) ghc/alloc   198411784.0   198608512.0  +0.1%
            T4801(normal) ghc/alloc   312416688.0   312874976.0  +0.1%
         T5321Fun(normal) ghc/alloc   325230680.0   325474448.0  +0.1%
            T5631(normal) ghc/alloc   592064448.0   593518968.0  +0.2%
            T5837(normal) ghc/alloc    37691496.0    37710904.0  +0.1%
             T783(normal) ghc/alloc   404629536.0   405064432.0  +0.1%
            T9020(optasm) ghc/alloc   266004608.0   266375592.0  +0.1%
            T9198(normal) ghc/alloc    49221336.0    49268648.0  +0.1%
            T9233(normal) ghc/alloc   913464984.0   742680256.0 -18.7% GOOD
            T9675(optasm) ghc/alloc   552296608.0   466322000.0 -15.6% GOOD
           T9872a(normal) ghc/alloc  1789910616.0  1793924472.0  +0.2%
           T9872b(normal) ghc/alloc  2315141376.0  2310338056.0  -0.2%
           T9872c(normal) ghc/alloc  1840422424.0  1841567224.0  +0.1%
           T9872d(normal) ghc/alloc   556713248.0   556838432.0  +0.0%
            T9961(normal) ghc/alloc   383809160.0   384601600.0  +0.2%
            WWRec(normal) ghc/alloc   773751272.0   753949608.0  -2.6% GOOD

Residency goes down too:

Metrics: compile_time/max_bytes_used
------------------------------------
                             Baseline
           Test  Metric         value     New value Change
-----------------------------------------------------------
 T10370(optasm) ghc/max    42058448.0    39481672.0  -6.1%
 T11545(normal) ghc/max    43641392.0    43634752.0  -0.0%
 T15304(normal) ghc/max    29895824.0    29439032.0  -1.5%
 T15630(normal) ghc/max     8822568.0     8772328.0  -0.6%
T18698a(normal) ghc/max    13882536.0    13787112.0  -0.7%
T18698b(normal) ghc/max    14714112.0    13836408.0  -6.0%
  T1969(normal) ghc/max    24724128.0    24733496.0  +0.0%
  T3064(normal) ghc/max    14041152.0    14034768.0  -0.0%
  T3294(normal) ghc/max    32769248.0    32760312.0  -0.0%
  T9630(normal) ghc/max    41605120.0    41572184.0  -0.1%
  T9675(optasm) ghc/max    18652296.0    17253480.0  -7.5%

Metric Decrease:
    T10421
    T12227
    T15164
    T17516
    T18698a
    T18698b
    T9233
    T9675
    WWRec

Metric Increase:
    T12545
parent cced9454
No related branches found
No related tags found
No related merge requests found
Showing
with 109 additions and 182 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment