Skip to content
Snippets Groups Projects
  1. Apr 20, 2021
    • Sebastian Graf's avatar
      Worker/wrapper: Refactor CPR WW to work for nested CPR (#18174) · fdbead70
      Sebastian Graf authored
      In another small step towards bringing a manageable variant of Nested
      CPR into GHC, this patch refactors worker/wrapper to be able to exploit
      Nested CPR signatures. See the new Note [Worker/wrapper for CPR].
      
      The nested code path is currently not triggered, though, because all
      signatures that we annotate are still flat. So purely a refactoring.
      I am very confident that it works, because I ripped it off !1866 95%
      unchanged.
      
      A few test case outputs changed, but only it's auxiliary names only.
      I also added test cases for #18109 and #18401.
      
      There's a 2.6% metric increase in T13056 after a rebase, caused by an
      additional Simplifier run. It appears b1d0b9c saw a similar additional
      iteration. I think it's just a fluke.
      
      Metric Increase:
          T13056
      fdbead70
    • Sebastian Graf's avatar
      Worker/wrapper: Consistent names · 0e541137
      Sebastian Graf authored
      0e541137
    • Sebastian Graf's avatar
      Refactor around `wantToUnbox` · ee5dadad
      Sebastian Graf authored
      I renamed `wantToUnbox` to `wantToUnboxArg` and then introduced
      `wantToUnboxResult`, which we call in `mkWWcpr_one` now.
      
      I also deleted `splitArgType_maybe` (the single call site outside of
      `wantToUnboxArg` actually cared about the result type of a function, not
      an argument) and `splitResultType_maybe` (which is entirely superceded
      by `wantToUnboxResult`.
      ee5dadad
    • Sebastian Graf's avatar
      Factor out DynFlags from WorkWrap.Utils · 99bd4ae6
      Sebastian Graf authored
      Plus a few minor refactorings:
      
        * Introduce `normSplitTyConApp_maybe` to Core.Utils
        * Reduce boolean blindness in the Bool argument to `wantToUnbox`
        * Let `wantToUnbox` also decide when to drop an argument, cleaning up
          `mkWWstr_one`
      99bd4ae6
  2. Apr 19, 2021
  3. Apr 18, 2021
    • Matthew Pickering's avatar
      Only load package environment file once when starting GHCi · 40d28436
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Since d880d6b2 the parsing of the
      environment files was moved to `parseDynamicFlags`, under the assumption
      it was typically only called once. It turns out not to be true in GHCi
      and this led to continually reparsing the environment file whenever a
      new option was set, the options were appended to the package state and
      hence all packages reloaded, as it looked like the options were changed.
      
      The simplest fix seems to be a clearer specification:
      
      > Package environment files are only loaded in GHCi during initialisation.
      
      Fixes #19650
      40d28436
  4. Apr 17, 2021
    • Simon Peyton Jones's avatar
      Improvements in SpecConstr · c71b2204
      Simon Peyton Jones authored
      * Allow under-saturated calls to specialise
        See Note [SpecConstr call patterns]
        This just allows a bit more specialisation to take place.
      
      * Don't discard calls from un-specialised RHSs.  This was
        a plain bug in `specialise`, again leading to loss of
        specialisation.  Refactoring yields an `otherwise`
        case that is easier to grok.
      
      * I refactored CallPat to become a proper data type, not a tuple.
      
      All this came up when I was working on eta-reduction.  The ticket
      is #19672.
      
      The nofib results are mostly zero, with a couple of big wins:
      
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
      --------------------------------------------------------------------------------
               awards          +0.2%     -0.1%    -18.7%    -18.8%      0.0%
        comp_lab_zift          +0.2%     -0.2%    -23.9%    -23.9%      0.0%
                 fft2          +0.2%     -1.0%    -34.9%    -36.6%      0.0%
                  hpg          +0.2%     -0.3%    -18.4%    -18.4%      0.0%
                 mate          +0.2%    -15.7%    -19.3%    -19.3%    +11.1%
               parser          +0.2%     +0.6%    -16.3%    -16.3%      0.0%
               puzzle          +0.4%    -19.7%    -33.7%    -34.0%      0.0%
              rewrite          +0.2%     -0.5%    -20.7%    -20.7%      0.0%
      --------------------------------------------------------------------------------
                  Min          +0.2%    -19.7%    -48.1%    -48.9%      0.0%
                  Max          +0.4%     +0.6%     -1.2%     -1.1%    +11.1%
       Geometric Mean          +0.2%     -0.4%    -21.0%    -21.1%     +0.1%
      
      I investigated the 0.6% increase on 'parser'.  It comes because SpecConstr
      has a limit of 3 specialisations.  With HEAD, hsDoExpr has 2
      specialisations, and then a further several from the specialised
      bodies, of which 1 is picked.  With this patch we get 3
      specialisations right off the bat, so we discard all from the
      recursive calls.  Turns out that that's not the best choice, but there
      is no way to tell that.  I'm accepting it.
      
      NB: these figures actually come from this patch plus the preceding one for
      StgCSE, but I think the gains come from SpecConstr.
      c71b2204
    • Simon Peyton Jones's avatar
      Improve CSE in STG-land · 7bd12940
      Simon Peyton Jones authored
      This patch fixes #19717, a long-standing bug in CSE for STG, which
      led to a stupid loss of CSE in some situations.
      
      It's explained in Note [Trivial case scrutinee], which I have
      substantially extended.
      7bd12940
  5. Apr 15, 2021
    • Simon Peyton Jones's avatar
      Fix handling ze_meta_tv_env in GHC.Tc.Utils.Zonk · 0a8c14bd
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      As #19668 showed, there was an /asymptotic/ slow-down in zonking in
      GHC 9.0, exposed in test T9198.  The bug was actually present in earlier
      compilers, but by a fluke didn't actually show up in any of our tests;
      but adding Quick Look exposed it.
      
      The bug was that in zonkTyVarOcc we
      1. read the meta-tyvar-env variable
      2. looked up the variable in the env
      3. found a 'miss'
      4. looked in the variable, found `Indirect ty`
      5. zonked `ty`
      6. update the env *gotten from step 1* to map the variable
         to its zonked type.
      
      The bug is that we thereby threw away all teh work done in step 4.
      In T9198 that made an enormous, indeed asymptotic difference.
      
      The fix is easy: use updTcRef.
      
      I commented in `Note [Sharing when zonking to Type]`
      
      -------------------------
      Metric Decrease:
          T9198
      -------------------------
      0a8c14bd
    • Matthew Pickering's avatar
      hie: Initialise the proper environment for calling dsExpr · da92e728
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      We now use DsM as the base monad for writing hie files and properly
      initialise it from the TcGblEnv.
      
      Before, we would end up reading the interface file from disk for the
      module we were currently compiling. The modules iface then ended up in
      the EPS causing all sorts of subtle
      carnage, including difference in the generated core and haddock emitting
      a lot of warnings. With the fix, the
      module in the TcGblEnv is set correctly so the lookups happen in the
      local name env rather than thinking the identifier comes from an
      external package.
      
      Fixes #19693 and #19334
      da92e728
  6. Apr 14, 2021
  7. Apr 13, 2021
  8. Apr 12, 2021
  9. Apr 10, 2021
Loading