1. 01 Apr, 2017 1 commit
    • rwbarton's avatar
      Stamp out space leaks from demand analysis · f2b10f35
      rwbarton authored
      This reduces peak memory usage by ~30% on my test case (DynFlags),
      and (probably as a result of reduced GC work) decreases compilation
      time by a few percent as well.
      
      Also fix a bug in seqStrDmd so that demeand info is fully evaluated.
      
      Reviewers: simonpj, austin, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: dfeuer, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3400
      f2b10f35
  2. 14 Mar, 2017 1 commit
  3. 08 Mar, 2017 1 commit
  4. 06 Mar, 2017 1 commit
  5. 01 Mar, 2017 1 commit
    • David Feuer's avatar
      Change catch# demand signature · 701256df
      David Feuer authored
      * Give `catch#` a lazy demand signature, to make it more honest.
      
      * Make `catchException` and `catchAny` force their arguments so they
      actually behave as advertised.
      
      * Use `catch` rather than `catchException` in `forkIO`, `forkOn`, and
      `forkOS` to avoid losing exceptions.
      
      Fixes #13330
      
      Reviewers: rwbarton, simonpj, simonmar, bgamari, hvr, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3244
      701256df
  6. 23 Feb, 2017 1 commit
  7. 09 Feb, 2017 1 commit
  8. 03 Feb, 2017 1 commit
  9. 01 Feb, 2017 1 commit
  10. 23 Jan, 2017 1 commit
  11. 18 Jan, 2017 1 commit
  12. 25 Aug, 2016 2 commits
    • Joachim Breitner's avatar
      WwLib: Add strictness signature to "let x = absentError …" · faaf3139
      Joachim Breitner authored
      indicating that it is bottom. This should help making the "empty cases"
      lint error give less false alarms.
      faaf3139
    • Joachim Breitner's avatar
      DmdAnal: Add a final, safe iteration · 8d92b88d
      Joachim Breitner authored
      this fixes #12368.
      
      It also refactors dmdFix a bit, removes some redundancies (such as
      passing around an strictness signature right next to an id, when that id
      is guaranteed to have been annotated with that strictness signature).
      
      Note that when fixed-point iteration does not terminate, we
      conservatively delete their strictness signatures (set them to nopSig).
      But this loses the information on how its strict free variables are
      used!
      
      Lazily used variables already escape via lazy_fvs. We ensure that in the
      case of an aborted fixed-point iteration, also the strict variables are
      put there (with a conservative demand of topDmd).
      
      Differential Revision: https://phabricator.haskell.org/D2392
      8d92b88d
  13. 01 Jul, 2016 1 commit
  14. 22 Jun, 2016 1 commit
  15. 17 Jun, 2016 1 commit
  16. 24 May, 2016 1 commit
    • niteria's avatar
      Document some benign nondeterminism · 4c6e69d5
      niteria authored
      I've changed the functions to their nonDet equivalents and explained
      why they're OK there. This allowed me to remove foldNameSet,
      foldVarEnv, foldVarEnv_Directly, foldVarSet and foldUFM_Directly.
      
      Test Plan: ./validate, there should be no change in behavior
      
      Reviewers: simonpj, simonmar, austin, goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2244
      
      GHC Trac Issues: #4012
      4c6e69d5
  17. 14 Apr, 2016 1 commit
    • Joachim Breitner's avatar
      Add a final demand analyzer run right before TidyCore · f4fd98c7
      Joachim Breitner authored
      in order to have precise used-once information in the exported
      strictness signatures, as well as precise used-once information on
      thunks. This avoids the bad effects of #11731.
      
      The subsequent worker-wrapper pass is responsible for removing the
      demand environment part of the strictness signature. It does not run
      after the final demand analyzer pass, so remove this also in CoreTidy.
      
      The subsequent worker-wrapper pass is also responsible for removing
      used-once-information from the demands and strictness signatures, as
      these might not be preserved by the simplifier. This is _not_ done by
      CoreTidy, because we _do_ want this information, as produced by the last
      round of the demand analyzer, to be available to the code generator.
      
      Differential Revision: https://phabricator.haskell.org/D2073
      f4fd98c7
  18. 06 Apr, 2016 1 commit
    • Joachim Breitner's avatar
      Demand Analyzer: Do not set OneShot information (second try) · 0f58d348
      Joachim Breitner authored
      as suggested in ticket:11770#comment:1. This code was buggy
      (#11770), and the occurrence analyzer does the same job anyways.
      
      This also elaborates the notes in the occurrence analyzer accordingly.
      
      Previously, the worker/wrapper code would go through lengths to transfer
      the oneShot annotations from the original function to both the worker
      and the wrapper. We now simply transfer the demand on the worker, and
      let the subsequent occurrence analyzer push this onto the lambda
      binders.
      
      This also requires the occurrence analyzer to do this more reliably.
      Previously, it would not hand out OneShot annotatoins to things that
      would not `certainly_inline` (and it might not have mattered, as the
      Demand Analysis might have handed out the annotations). Now we hand out
      one-shot annotations unconditionally.
      
      Differential Revision: https://phabricator.haskell.org/D2085
      0f58d348
  19. 31 Mar, 2016 1 commit
  20. 29 Mar, 2016 2 commits
  21. 11 Feb, 2016 1 commit
  22. 27 Jan, 2016 1 commit
  23. 18 Jan, 2016 1 commit
    • Jan Stolarek's avatar
      Replace calls to `ptext . sLit` with `text` · b8abd852
      Jan Stolarek authored
      Summary:
      In the past the canonical way for constructing an SDoc string literal was the
      composition `ptext . sLit`.  But for some time now we have function `text` that
      does the same.  Plus it has some rules that optimize its runtime behaviour.
      This patch takes all uses of `ptext . sLit` in the compiler and replaces them
      with calls to `text`.  The main benefits of this patch are clener (shorter) code
      and less dependencies between module, because many modules now do not need to
      import `FastString`.  I don't expect any performance benefits - we mostly use
      SDocs to report errors and it seems there is little to be gained here.
      
      Test Plan: ./validate
      
      Reviewers: bgamari, austin, goldfire, hvr, alanz
      
      Subscribers: goldfire, thomie, mpickering
      
      Differential Revision: https://phabricator.haskell.org/D1784
      b8abd852
  24. 07 Jan, 2016 1 commit
    • Simon Peyton Jones's avatar
      Make demand analysis understand catch · 9915b656
      Simon Peyton Jones authored
      As Trac #11222, and #10712 note, the strictness analyser
      needs to be rather careful about exceptions.  Previously
      it treated them as identical to divergence, but that
      won't quite do.
      
      See Note [Exceptions and strictness] in Demand, which
      explains the deal.
      
      Getting more strictness in 'catch' and friends is a
      very good thing.  Here is the nofib summary, keeping
      only the big ones.
      
      --------------------------------------------------------------------------------
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
      --------------------------------------------------------------------------------
                fasta          -0.1%     -6.9%     -3.0%     -3.0%     +0.0%
                  hpg          -0.1%     -2.0%     -6.2%     -6.2%     +0.0%
             maillist          -0.1%     -0.3%      0.08      0.09     +1.2%
      reverse-complem          -0.1%    -10.9%     -6.0%     -5.9%     +0.0%
               sphere          -0.1%     -4.3%      0.08      0.08     +0.0%
                 x2n1          -0.1%     -0.0%      0.00      0.00     +0.0%
      --------------------------------------------------------------------------------
                  Min          -0.2%    -10.9%    -17.4%    -17.3%     +0.0%
                  Max          -0.0%     +0.0%     +4.3%     +4.4%     +1.2%
       Geometric Mean          -0.1%     -0.3%     -2.9%     -3.0%     +0.0%
      
      On the way I did quite a bit of refactoring in Demand.hs
      9915b656
  25. 05 Aug, 2015 1 commit
  26. 03 Aug, 2015 1 commit
  27. 29 Jul, 2015 1 commit
  28. 21 Jul, 2015 1 commit
    • Simon Peyton Jones's avatar
      Improve strictness analysis for exceptions · 7c0fff41
      Simon Peyton Jones authored
      Two things here:
      
      * For exceptions-catching primops like catch#, we know
        that the main argument function will be called, so
        we can use strictApply1Dmd, rather than lazy
      
        Changes in primops.txt.pp
      
      * When a 'case' scrutinises a I/O-performing primop,
        the Note [IO hack in the demand analyser] was
        throwing away all strictness from the code that
        followed.
      
        I found that this was causing quite a bit of unnecessary
        reboxing in the (heavily used) function
        GHC.IO.Handle.Internals.wantReadableHandle
      
        So this patch prevents the hack applying when the
        case scrutinises a primop.  See the revised
        Note [IO hack in the demand analyser]
      
      Thse two things buy us quite a lot in programs that do a lot of IO.
      
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
      --------------------------------------------------------------------------------
                  hpg          -0.4%     -2.9%     -0.9%     -1.0%     +0.0%
      reverse-complem          -0.4%    -10.9%    +10.7%    +10.9%     +0.0%
               simple          -0.3%     -0.0%    +26.2%    +26.2%     +3.7%
               sphere          -0.3%     -6.3%      0.09      0.09     +0.0%
      --------------------------------------------------------------------------------
                  Min          -0.7%    -10.9%     -4.6%     -4.7%     -1.7%
                  Max          -0.2%     +0.0%    +26.2%    +26.2%     +6.5%
       Geometric Mean          -0.4%     -0.3%     +2.1%     +2.1%     +0.1%
      
      I think the increase in runtime for 'simple' is measurement error.
      7c0fff41
  29. 08 Jul, 2015 1 commit
  30. 14 Apr, 2015 1 commit
    • Simon Peyton Jones's avatar
      Zap usage info in CSE (Trac #10218) · d261d4cb
      Simon Peyton Jones authored
      Trac #10218 reports a subtle bug that turned out to be:
      
      - CSE invalidated the usage information computed
        by earlier demand analysis, by increasing sharing
      
      - that made a single-entry thunk into a multi-entry thunk
      
      - and with -feager-blackholing, that led to <<loop>>
      
      The patch fixes it by making the CSE pass zap usage information for
      let-bound identifiers.   It can be restored by -flate-dmd-anal.
      
      (But making -flate-dmd-anal the default needs some careful work;
      see Trac #7782.)
      d261d4cb
  31. 10 Apr, 2015 1 commit
  32. 07 Apr, 2015 1 commit
    • Simon Peyton Jones's avatar
      Fix a long-standing bug in the demand analyser · 9f0f99fd
      Simon Peyton Jones authored
      This patch fixes Trac #10148, an outright and egregious
      bug in the demand analyser.
      
      It is explained in Note [Demand on case-alternative binders]
      in Demand.hs.
      
      I did some other minor refactoring.
      
      To my astonishment I got some big compiler perf changes
      
      * perf/compiler/T5837: bytes allocated -76%
      * perf/compiler/T5030: bytes allocated -10%
      * perf/compiler/T3294: max bytes used  -25%
      
      Happy days
      9f0f99fd
  33. 04 Mar, 2015 1 commit
  34. 03 Dec, 2014 1 commit
  35. 04 Nov, 2014 1 commit
  36. 13 Oct, 2014 1 commit
  37. 01 Jul, 2014 1 commit
    • Simon Peyton Jones's avatar
      Fix demand analyser for unboxed types · d6ee82b2
      Simon Peyton Jones authored
      This is a tricky case exposed by Trac #9254.  I'm surprised it hasn't
      shown up before, because it's happens when you use unsafePerformIO in
      the right way.
      
      Anyway, fixed now.  See Note [Analysing with absent demand]
      in Demand.lhs
      d6ee82b2
  38. 20 Jun, 2014 1 commit