This project is mirrored from https://gitlab.haskell.org/ghc/ghc.git. Pull mirroring failed .
Repository mirroring has been paused due to too many failed attempts. It can be resumed by a project maintainer.
Last successful update .
  1. 02 Mar, 2018 1 commit
  2. 08 Dec, 2017 1 commit
  3. 29 Oct, 2017 1 commit
    • Joachim Breitner's avatar
      Implement a dedicated exitfication pass #14152 · 0e953da1
      Joachim Breitner authored
      The idea is described in #14152, and can be summarized: Float the exit
      path out of a joinrec, so that the simplifier can do more with it.
      See the test case for a nice example.
      
      The floating goes against what the simplifier usually does, hence we
      need to be careful not inline them back.
      
      The position of exitification in the pipeline was chosen after a small
      amount of experimentation, but may need to be improved. For example,
      exitification can allow rewrite rules to fire, but for that it would
      have to happen before the `simpl_phases`.
      
      Perf.haskell.org reports these nice performance wins:
      
          Nofib allocations
          fannkuch-redux    78446640  - 99.92%      64560
          k-nucleotide     109466384  - 91.32%    9502040
          simple            72424696  -  5.96%   68109560
      
          Nofib instruction counts
          fannkuch-redux  1744331636  -  3.86% 1676999519
          k-nucleotide    2318221965  -  6.30% 2172067260
          scs             1978470869  -  3.35% 1912263779
          simple           669858104  -  3.38%  647206739
          spectral-norm    186423292  -  5.37%  176411536
      
      Differential Revision: https://phabricator.haskell.org/D3903
      0e953da1
  4. 19 Sep, 2017 1 commit
    • Herbert Valerio Riedel's avatar
      compiler: introduce custom "GhcPrelude" Prelude · f63bc730
      Herbert Valerio Riedel authored
      This switches the compiler/ component to get compiled with
      -XNoImplicitPrelude and a `import GhcPrelude` is inserted in all
      modules.
      
      This is motivated by the upcoming "Prelude" re-export of
      `Semigroup((<>))` which would cause lots of name clashes in every
      modulewhich imports also `Outputable`
      
      Reviewers: austin, goldfire, bgamari, alanz, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: goldfire, rwbarton, thomie, mpickering, bgamari
      
      Differential Revision: https://phabricator.haskell.org/D3989
      f63bc730
  5. 25 Aug, 2017 1 commit
    • Simon Peyton Jones's avatar
      Refactor the Mighty Simplifier · 33452dfc
      Simon Peyton Jones authored
      Triggered by #12150, and the knock-on effects of join points, I did a
      major refactoring of the Simplifier.  This is a big patch that change
      a lot of Simplify.hs: I did a lot of other re-organisation.
      
      The main event
      ~~~~~~~~~~~~~~
      Since the dawn of time we have had
        simplExpr :: SimplEnv -> InExpr -> SimplCont
                  -> SimplM (SimplEnv, OutExpr)
      
      What's that SimplEnv in the result?  When simplifying an expression the
      simplifier add floated let-bindings to the SimplEnv, extending the
      in-scope set appropriately, and hence needs to resturn the SimplEnv at
      the end.  The mode, flags, substitution in the returned SimplEnv were
      all irrelevant: it was just the floating bindings.
      
      It's strange to accumulate part of the /result/ in the /environment/
      argument!  And indeed its leads to all manner of mysterious calls to
      zapFloats and transferring of floats from one SimplEnv to another.
      It got worse with join points, so I finally bit the bullet and refactored.
      Now we have
        simplExpr :: SimplEnv -> InExpr -> SimplCont
                  -> SimplM (SimplFloats, OutExpr)
        -- See Note [The big picture]
      and the SimplEnv no longer has floats in it.  The code is no shorter,
      but it /is/ easier to understand.
      
      Main changes
      
      * Remove seLetFloats field from SimplEnv
      
      * Define new data type SimplFloats, and functions over it
      
      * Change the types of simplExpr, simplBind, and their many variants,
        to follow the above plan
      
      Bottoming bindings
      ~~~~~~~~~~~~~~~~~~
      I made one other significant change in SimplUtils (not just refactoring),
      related to Trac #12150 comment:16.  Given
        x = <rhs>
      where <rhs> turns out to be a bottoming expression, propagate that
      information to x's IdInfo immediately.  That's always good, because
      it makes x be inlined less (we don't inline bottoming things), and
      it allows (case x of ...) to drop the dead alterantives immediately.
      Moreover, we are doing the analysis anyway, in tryEtaExpandRhs, which
      calls CoreArity.findRhsArity, which already does simple bottom analysis.
      So we are generating the information; all we need do is to atach the
      bottoming info to the IdInfo.
      
      See Note [Bottoming bindings]
      
      Smaller refactoring
      ~~~~~~~~~~~~~~~~~~~
      * Rename SimplifierMode to SimplMode
      * Put DynFlags as a new field in SimplMode, to make fewer
        monadic calls to getDynFlags.
      * Move the code in addPolyBind into abstractFloats
      * Move the "don't eta-expand join points" into tryEtaExpandRhs
      33452dfc
  6. 20 Jul, 2017 1 commit
  7. 29 Apr, 2017 1 commit
  8. 01 Apr, 2017 1 commit
  9. 15 Mar, 2017 1 commit
    • Ben Gamari's avatar
      Introduce putLogMsg · 086b514b
      Ben Gamari authored
      This factors out the repetition of (log_action dflags dflags) and will
      hopefully allow us to someday better abstract log output.
      
      Test Plan: Validate
      
      Reviewers: austin, hvr, goldfire
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3334
      086b514b
  10. 28 Feb, 2017 1 commit
    • Simon Peyton Jones's avatar
      The Early Inline Patch · 2effe18a
      Simon Peyton Jones authored
      This very small patch switches on sm_inline even in the InitialPhase
      (aka "gentle" phase).   There is no reason not to... and the results
      are astonishing.
      
      I think the peformance of GHC itself improves by about 5%; and some
      programs get much smaller, quicker.  Result: across the board
      irmprovements in
      compile time performance.  Here are the changes in perf/compiler;
      the numbers are decreases in compiler bytes-allocated:
      
        3%   T5837
        7%   parsing001
        9%   T12234
        35%  T9020
        9%   T3064
        13%  T9961
        20%  T13056
        5%   T9872d
        5%   T9872c
        5%   T9872b
        7%   T9872a
        5%   T783
        35%  T12227
        20%  T1969
      
      Plus in perf/should_run
      
        5%   lazy-bs-alloc
      
      It wasn't as easy as it sounds: I did a raft of preparatory work in
      earlier patches.  But it's great!
      
      Reviewers: austin, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3203
      2effe18a
  11. 27 Feb, 2017 1 commit
    • Simon Peyton Jones's avatar
      Refactor floating of bindings (fiBind) · e4188b53
      Simon Peyton Jones authored
      This is just a local refactoring.
      
      I originally planned to try floating top-level bindings inwards,
      but I backed off from that leaving only this (harmless) refactoring,
      which has no behavioural effect.
      
      I also make FloatIn into a ModGuts -> ModGuts function; again not
      necessary now, but no harm either.
      
      My attempt also used the new function CoreFVs.freeVarsBind; but
      that too is a plausible refactorig of freeVars, so I left it in too.
      
      Reviewers: austin, bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D3180
      e4188b53
  12. 06 Feb, 2017 1 commit
  13. 03 Feb, 2017 1 commit
    • Sylvain Henry's avatar
      Ditch static flags · bbd3c399
      Sylvain Henry authored
      This patch converts the 4 lasting static flags (read from the command
      line and unsafely stored in immutable global variables) into dynamic
      flags. Most use cases have been converted into reading them from a DynFlags.
      
      In cases for which we don't have easy access to a DynFlags, we read from
      'unsafeGlobalDynFlags' that is set at the beginning of each 'runGhc'.
      It's not perfect (not thread-safe) but it is still better as we can
      set/unset these 4 flags before each run when using GHC API.
      
      Updates haddock submodule.
      
      Rebased and finished by: bgamari
      
      Test Plan: validate
      
      Reviewers: goldfire, erikd, hvr, austin, simonmar, bgamari
      
      Reviewed By: simonmar
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2839
      
      GHC Trac Issues: #8440
      bbd3c399
  14. 01 Feb, 2017 1 commit
  15. 13 Jan, 2017 1 commit
  16. 06 Jan, 2017 2 commits
  17. 23 Dec, 2016 1 commit
  18. 01 Nov, 2016 1 commit
  19. 21 Oct, 2016 1 commit
  20. 05 Jul, 2016 1 commit
    • niteria's avatar
      Use DVarEnv for vectInfoVar · 55e43a6f
      niteria authored
      This makes sure that we don't introduce unnecessary
      nondeterminism from vectorization.
      
      Also updates dph submodule to reflect the change in types.
      
      GHC Trac: #4012
      55e43a6f
  21. 28 Jun, 2016 1 commit
    • Facundo Domínguez's avatar
      Stop the simplifier from removing StaticPtr binds. · dd92c67b
      Facundo Domínguez authored
      Summary:
      We have the FloatOut pass create exported ids for floated StaticPtr
      bindings. The simplifier doesn't try to remove those.
      
      This patch also improves on 7fc20b by making a common definition
      collectStaticPtrSatArgs to test for StaticPtr binds.
      
      Fixes #12207.
      
      Test Plan: ./validate
      
      Reviewers: simonpj, austin, bgamari, simonmar, goldfire
      
      Reviewed By: simonpj
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2366
      
      GHC Trac Issues: #12207
      dd92c67b
  22. 17 Jun, 2016 1 commit
  23. 17 May, 2016 1 commit
  24. 10 May, 2016 1 commit
  25. 02 May, 2016 1 commit
    • Facundo Domínguez's avatar
      StaticPointers: Allow closed vars in the static form. · 36d29f7c
      Facundo Domínguez authored
      Summary:
      With this patch closed variables are allowed regardless of whether
      they are bound at the top level or not.
      
      The FloatOut pass is always performed. When optimizations are
      disabled, only expressions that go to the top level are floated.
      Thus, the applications of the StaticPtr data constructor are always
      floated.
      
      The CoreTidy pass makes sure the floated applications appear in the
      symbol table of object files. It also collects the floated bindings
      and inserts them in the static pointer table.
      
      The renamer does not check anymore if free variables appearing in the
      static form are top-level. Instead, the typechecker looks at the
      tct_closed flag to decide if the free variables are closed.
      
      The linter checks that applications of StaticPtr only occur at the
      top of top-level bindings after the FloatOut pass.
      
      The field spInfoName of StaticPtrInfo has been removed. It used to
      contain the name of the top-level binding that contains the StaticPtr
      application. However, this information is no longer available when the
      StaticPtr is constructed, as the binding name is determined now by the
      FloatOut pass.
      
      Test Plan: ./validate
      
      Reviewers: goldfire, simonpj, austin, hvr, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: thomie, mpickering, mboes
      
      Differential Revision: https://phabricator.haskell.org/D2104
      
      GHC Trac Issues: #11656
      36d29f7c
  26. 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
  27. 24 Mar, 2016 1 commit
    • Ben Gamari's avatar
      ErrUtils: Add timings to compiler phases · 8048d51b
      Ben Gamari authored
      This adds timings and allocation figures to the compiler's output when
      run with `-v2` in an effort to ease performance analysis.
      
      Todo:
        * Documentation
        * Where else should we add these?
        * Perhaps we should remove some of the now-arguably-redundant
          `showPass` occurrences where they are
        * Must we force more?
        * Perhaps we should place this behind a `-ftimings` instead of `-v2`
      
      Test Plan: `ghc -v2 Test.hs`, look at the output
      
      Reviewers: hvr, goldfire, simonmar, austin
      
      Reviewed By: simonmar
      
      Subscribers: angerman, michalt, niteria, ezyang, thomie
      
      Differential Revision: https://phabricator.haskell.org/D1959
      8048d51b
  28. 25 Feb, 2016 1 commit
    • barrucadu's avatar
      Print which warning-flag controls an emitted warning · bb5afd3c
      barrucadu authored
      Both gcc and clang tell which warning flag a reported warning can be
      controlled with, this patch makes ghc do the same. More generally, this
      allows for annotated compiler output, where an optional annotation is
      displayed in brackets after the severity.
      
      This also adds a new flag `-f(no-)show-warning-groups` to control
      whether to show which warning-group (such as `-Wall` or `-Wcompat`)
      a warning belongs to. This flag is on by default.
      
      This implements #10752
      
      Reviewed By: quchen, bgamari, hvr
      
      Differential Revision: https://phabricator.haskell.org/D1943
      bb5afd3c
  29. 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
  30. 29 Nov, 2015 1 commit
    • Ömer Sinan Ağacan's avatar
      Some improvements on CoreToDos passed to plugins · bcd55a94
      Ömer Sinan Ağacan authored
      This patch does two improvements:
      
      - We now show ToDos in `CoreDoPasses`. This is pretty important,
        otherwise `CoreDoPasses` makes debugging impossible in some cases.
      
      - Before running ToDos we run a cleanup pass on ToDos to remove
        `CoreDoNothing`s and flatten `CoreDoPasses`. This removes a lot of
        noise from `[CoreToDo]` argument passed to plugins.
      
      Reviewers: simonpj, bgamari, austin
      
      Reviewed By: bgamari, austin
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D1548
      bcd55a94
  31. 27 Oct, 2015 1 commit
  32. 10 Oct, 2015 1 commit
  33. 05 Aug, 2015 1 commit
    • Simon Peyton Jones's avatar
      Allow proper errors/warnings in core2core passes · e2b57381
      Simon Peyton Jones authored
      This patch makes it possible for core-to-core passes to emit
      proper error messages and warnings.
      
        * New function CoreMonad.warnMsg
      
        * CoreMonad.warnMsg and errorMsg now print a proper warning/error
          message heading.
      
        * CoreMonad carries a SrcSpan, which is used in warning/error
          messages.  It is initialised to be the source file name, but
          a core-to-core pass could set it more specifically if it had
          better location information.
      
      There was a bit of plumbing needed to get the filename to the
      right place.
      e2b57381
  34. 27 Jul, 2015 1 commit
  35. 16 Jul, 2015 1 commit
  36. 20 Jun, 2015 1 commit
    • Edward Z. Yang's avatar
      Filter orphan rules based on imports, fixes #10294 and #10420. · 0cb1f5cf
      Edward Z. Yang authored
      Summary:
      If we have an orphan rule in our database, don't apply it
      unless the defining module is transitively imported by the
      module we are processing.  We do this by defining a new RuleEnv
      data type which includes both the RuleBase as well as the set
      of visible orphan modules, and threading this through the
      relevant environments (CoreReader, RuleCheckEnv and ScEnv).
      
      This is analogous to the instances fix we applied in #2182
      4c834fdd
      
      , but done for RULES.
      An important knock-on effect is that we can remove some buggy
      code in LoadInterface which tried to avoid loading interfaces
      that were loaded by plugins (which sometimes caused instances
      and rules to NEVER become visible).
      
      One note about tests: I renamed the old plugins07 test to T10420
      and replaced plugins07 with a test to ensure that a plugin
      import did not cause new rules to be loaded in.
      Signed-off-by: default avatarEdward Z. Yang <ezyang@cs.stanford.edu>
      
      Test Plan: validate
      
      Reviewers: simonpj, austin, goldfire
      
      Subscribers: bgamari, thomie
      
      Differential Revision: https://phabricator.haskell.org/D950
      
      GHC Trac Issues: #10420
      0cb1f5cf
  37. 01 Jun, 2015 1 commit
  38. 22 May, 2015 1 commit
    • Simon Peyton Jones's avatar
      Fix a huge space leak in the mighty Simplifier · 45d9a15c
      Simon Peyton Jones authored
      This long-standing, terrible, adn somewhat subtle bug was exposed
      by Trac #10370, thanks to Reid Barton's brilliant test case (comment:3).
      
      The effect is large on the Trac #10370 test.
      Here is what the profile report says:
      
      Before:
       total time  =       24.35 secs   (24353 ticks @ 1000 us, 1 processor)
       total alloc = 11,864,360,816 bytes  (excludes profiling overheads)
      
      After:
       total time  =       21.16 secs   (21160 ticks @ 1000 us, 1 processor)
       total alloc = 7,947,141,136 bytes  (excludes profiling overheads)
      
      The /combined/ effect of the tidyOccName fix, plus this one, is dramtic
      for Trac #10370.  Here is what +RTS -s says:
      
      Before:
        15,490,210,952 bytes allocated in the heap
         1,783,919,456 bytes maximum residency (20 sample(s))
      
        MUT     time   30.117s  ( 31.383s elapsed)
        GC      time   90.103s  ( 90.107s elapsed)
        Total   time  120.843s  (122.065s elapsed)
      
      After:
         7,928,671,936 bytes allocated in the heap
            52,914,832 bytes maximum residency (25 sample(s))
      
        MUT     time   13.912s  ( 15.110s elapsed)
        GC      time    6.809s  (  6.808s elapsed)
        Total   time   20.789s  ( 21.954s elapsed)
      
      - Heap allocation halved
      - Residency cut by a factor of more than 30.
      - ELapsed time cut by a factor of 6
      
      Not bad!
      
      The details
      ~~~~~~~~~~~
      The culprit was SimplEnv.mkCoreSubst, which used mapVarEnv to do some
      impedence-matching from the substitituion used by the simplifier to
      the one used by CoreSubst.  But the impedence-mactching was recursive!
      
        mk_subst tv_env cv_env id_env
          = CoreSubst.mkSubst in_scope tv_env cv_env (mapVarEnv fiddle id_env)
      
        fiddle (DoneEx e)          = e
        fiddle (DoneId v)          = Var v
        fiddle (ContEx tv cv id e) = CoreSubst.substExpr (mk_subst tv cv id) e
      
      Inside fiddle, in the ContEx case, we may do another whole level of
      fiddle.  And so on.  Moreover, UniqFM (which is built on Data.IntMap) is
      strict, so the fiddling is done eagerly.  I didn't wok through all the
      details but the result is a gargatuan blow-up of entirely unnecessary work.
      
      Laziness would make this go away, I think, but I don't want to mess
      with IntMap.  And in any case, the impedence matching is a royal pain.
      
      In the end I simply ceased trying to use CoreSubst.substExpr in the
      simplifier, and instead just use simplExpr.  That does mean bit of
      duplication; e.g.  new code for simplRules.  But it's not a big deal
      and it's far more direct and easy to reason about.
      
      A bit of knock-on refactoring:
      
       * Data type ArgSummary moves to CoreUnfold.
      
       * interestingArg moves from CoreUnfold to SimplUtils, and gets a
         SimplEnv argument which can be used when we encounter a variable.
      
       * simplLamBndrs, addBndrRules move from SimplEnv to Simplify
         (because they now calls simplUnfolding, simplRules resp)
      
       * SimplUtils.substExpr, substUnfolding, mkCoreSubst die completely
      
       * In Simplify some several functions that were previously pure
         substitution-based functions are now monadic:
           - addBndrRules, simplRule
           - addCoerce, add_coerce in simplCast
      
       * In case 2c of Simplify.rebuildCase, there was a pretty disgusting
         expression-substitution taking place for 'rhs'; and we really don't
         want to make that monadic becuase 'rhs' can be big.
         Solution: reduce the arity of the rules for seq.
         See Note [User-defined RULES for seq] in MkId.
      45d9a15c
  39. 17 Mar, 2015 1 commit
    • Simon Peyton Jones's avatar
      Move declaration of Rulebase from Rules to CoreSyn · dbd92997
      Simon Peyton Jones authored
      This allow HscTypes to import CoreSyn rather than Rules, which makes
      module loops easier to avoid.  At one point in my recent travels this
      was important; I'm not sure it's so important now, but it's a good
      thing anyway.
      
      In any case CoreRule is defined in CoreSyn, so this move make sense.
      dbd92997