1. 23 Jan, 2017 1 commit
  2. 18 Jan, 2017 1 commit
  3. 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
  4. 01 Jul, 2016 1 commit
  5. 22 Jun, 2016 1 commit
  6. 17 Jun, 2016 1 commit
  7. 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
  8. 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
  9. 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
  10. 31 Mar, 2016 1 commit
  11. 29 Mar, 2016 2 commits
  12. 11 Feb, 2016 1 commit
  13. 27 Jan, 2016 1 commit
  14. 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
  15. 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
  16. 05 Aug, 2015 1 commit
  17. 03 Aug, 2015 1 commit
  18. 29 Jul, 2015 1 commit
  19. 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
  20. 08 Jul, 2015 1 commit
  21. 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
  22. 10 Apr, 2015 1 commit
  23. 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
  24. 04 Mar, 2015 1 commit
  25. 03 Dec, 2014 1 commit
  26. 04 Nov, 2014 1 commit
  27. 13 Oct, 2014 1 commit
  28. 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
  29. 20 Jun, 2014 1 commit
  30. 15 May, 2014 1 commit
    • Herbert Valerio Riedel's avatar
      Add LANGUAGE pragmas to compiler/ source files · 23892440
      Herbert Valerio Riedel authored
      In some cases, the layout of the LANGUAGE/OPTIONS_GHC lines has been
      reorganized, while following the convention, to
      
      - place `{-# LANGUAGE #-}` pragmas at the top of the source file, before
        any `{-# OPTIONS_GHC #-}`-lines.
      
      - Moreover, if the list of language extensions fit into a single
        `{-# LANGUAGE ... -#}`-line (shorter than 80 characters), keep it on one
        line. Otherwise split into `{-# LANGUAGE ... -#}`-lines for each
        individual language extension. In both cases, try to keep the
        enumeration alphabetically ordered.
        (The latter layout is preferable as it's more diff-friendly)
      
      While at it, this also replaces obsolete `{-# OPTIONS ... #-}` pragma
      occurences by `{-# OPTIONS_GHC ... #-}` pragmas.
      23892440
  31. 06 Mar, 2014 1 commit
    • Simon Peyton Jones's avatar
      Make the demand on a binder compatible with type (fixes Trac #8569) · 4b355cd2
      Simon Peyton Jones authored
      Because of GADTs and casts we were getting binders whose
      demand annotation was more deeply nested than made sense
      for its type.
      
      See Note [Trimming a demand to a type], in Demand.lhs,
      which I reproduce here:
      
         Note [Trimming a demand to a type]
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         Consider this:
      
           f :: a -> Bool
           f x = case ... of
                   A g1 -> case (x |> g1) of (p,q) -> ...
                   B    -> error "urk"
      
         where A,B are the constructors of a GADT.  We'll get a U(U,U) demand
         on x from the A branch, but that's a stupid demand for x itself, which
         has type 'a'. Indeed we get ASSERTs going off (notably in
         splitUseProdDmd, Trac #8569).
      
         Bottom line: we really don't want to have a binder whose demand is more
         deeply-nested than its type.  There are various ways to tackle this.
         When processing (x |> g1), we could "trim" the incoming demand U(U,U)
         to match x's type.  But I'm currently doing so just at the moment when
         we pin a demand on a binder, in DmdAnal.findBndrDmd.
      4b355cd2
  32. 01 Feb, 2014 1 commit
  33. 23 Jan, 2014 1 commit
    • Joachim Breitner's avatar
      Some polishing of the demand analyser. · 8d34ae39
      Joachim Breitner authored
      I did some refactoring of the demand analyser, because I was smelling
      some minor code smell. Most of my changes I had to undo, though,
      adding notes and testcases on why the existing code was correct after
      all.
      
      Especially the semantics of the DmdResult is confusing, as it differs in
      a DmdType and a StrictSig.
      
      I got to imrpove the readability of the code for lubDmdType, though.
      
      Also, dmdAnalRhs was a bit fishy in how it removed the demand on
      further arguments of the body, but used the DmdResult. This would be
      wrong if a body would return a demand type of "<L>m" (which currently
      does not happen).  This is now treated better in removeDmdTyArgs.
      8d34ae39
  34. 16 Jan, 2014 4 commits
  35. 10 Jan, 2014 1 commit