1. 02 Feb, 2018 1 commit
    • Michal Terepeta's avatar
      Hoopl.Collections: change right folds to strict left folds · 2974b2b8
      Michal Terepeta authored
      It seems that most uses of these folds should be strict left folds
      (I could only find a single place that benefits from a right fold).
      So this removes the existing `setFold`/`mapFold`/`mapFoldWihKey`
      replaces them with:
      - `setFoldl`/`mapFoldl`/`mapFoldlWithKey` (strict left folds)
      - `setFoldr`/`mapFoldr` (for the less common case where a right fold
        actually makes sense, e.g., `CmmProcPoint`)
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Test Plan: ./validate
      
      Reviewers: bgamari, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter, kavon
      
      Differential Revision: https://phabricator.haskell.org/D4356
      2974b2b8
  2. 21 Jan, 2018 1 commit
    • niteria's avatar
      Use IntSet in Dataflow · 88297438
      niteria authored
      Before this change, a list was used as a substitute for a heap.
      This led to quadratic behavior on a simple program (see new
      test case).
      
      This change replaces it with IntSet in effect reverting
      5a1a2633. @simonmar said it's fine to revert as long as nofib
      results are good.
      
      Test Plan:
      new test case:
      
      20% improvement
      3x improvement when N=10000
      
      nofib:
      
      I run it twice for before and after because the compile time
      results are noisy.
      
      - Compile Allocations:
      
      ```
                before    before re-run    after     after re-run
      -1 s.d.   -----     -0.0%            -0.1%     -0.1%
      +1 s.d.   -----     +0.0%            +0.1%     +0.1%
      Average   -----     +0.0%            -0.0%     -0.0%
      ```
      - Compile Time:
      
      ```
                before    before re-run    after     after re-run
      -1 s.d.   -----     -0.1%            -2.3%     -2.6%
      +1 s.d.   -----     +5.2%            +3.7%     +4.4%
      Average   -----     +2.5%            +0.7%     +0.8%
      
      ```
      I checked each case and couldn't find consistent slow-down/speed-up on
      compile time. Full results here: P173
      
      Reviewers: simonpj, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie, carter, simonmar
      
      GHC Trac Issues: #14667
      
      Differential Revision: https://phabricator.haskell.org/D4329
      88297438
  3. 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
  4. 23 Jun, 2017 1 commit
    • Michal Terepeta's avatar
      Hoopl: remove dependency on Hoopl package · 42eee6ea
      Michal Terepeta authored
      This copies the subset of Hoopl's functionality needed by GHC to
      `cmm/Hoopl` and removes the dependency on the Hoopl package.
      
      The main motivation for this change is the confusing/noisy interface
      between GHC and Hoopl:
      - Hoopl has `Label` which is GHC's `BlockId` but different than
        GHC's `CLabel`
      - Hoopl has `Unique` which is different than GHC's `Unique`
      - Hoopl has `Unique{Map,Set}` which are different than GHC's
        `Uniq{FM,Set}`
      - GHC has its own specialized copy of `Dataflow`, so `cmm/Hoopl` is
        needed just to filter the exposed functions (filter out some of the
        Hoopl's and add the GHC ones)
      With this change, we'll be able to simplify this significantly.
      It'll also be much easier to do invasive changes (Hoopl is a public
      package on Hackage with users that depend on the current behavior)
      
      This should introduce no changes in functionality - it merely
      copies the relevant code.
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Test Plan: ./validate
      
      Reviewers: austin, bgamari, simonmar
      
      Reviewed By: bgamari, simonmar
      
      Subscribers: simonpj, kavon, rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3616
      42eee6ea
  5. 19 Jun, 2017 1 commit
    • Michal Terepeta's avatar
      cmm/CmmLayoutStack: avoid generating unnecessary reloads · 6a2264d2
      Michal Terepeta authored
      This tries to be more precise when generating reloads of local
      registers in proc points. Previously we'd reload all local registers
      that were live. But we used liveness information that assumed local
      registers survive native calls. For the purpose of reloading registers
      this is an overapproximation and might lead to generating huge amounts
      of unnecessary reloads (in case there's another proc point before the
      register is used).
      
      This change takes the approach of moving the generation of reloads to
      a second pass over the Cmm, which allows to recompute the liveness and
      can use the knowledge that local registers do *not* survive calls.
      This leads to generating only useful reloads. For an extreme example
      where this helps a lot please see T3294. This should also fix #7198
      
      Finally, this re-introduces the code to do Cmm rewriting using in
      `Dataflow` module (with the difference that we know operate on a whole
      block at a time).
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Reviewers: austin, bgamari, simonmar
      
      Reviewed By: simonmar
      
      Subscribers: kavon, rwbarton, thomie
      
      GHC Trac Issues: #7198
      
      Differential Revision: https://phabricator.haskell.org/D3586
      6a2264d2
  6. 08 May, 2017 1 commit
    • Michal Terepeta's avatar
      Dataflow: use IntSet for mkDepBlocks · b99bae6d
      Michal Terepeta authored
      Using `IntSet` instead of `[Int]` is nicer since it gets rid of
      appending to a list (in the backward case) and folding over it is
      ordered.
      
      I also added a comment about how `mkDepBlocks` works since its
      behavior can be a bit surprising at first sight (it took me some time
      to see that it's doing the right thing ;)
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Test Plan: ./validate
      
      Reviewers: austin, bgamari, simonmar
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, thomie
      
      Differential Revision: https://phabricator.haskell.org/D3530
      b99bae6d
  7. 08 Dec, 2016 1 commit
  8. 29 Nov, 2016 1 commit
    • Michal Terepeta's avatar
      Hoopl/Dataflow: use block-oriented interface · 679ccd1c
      Michal Terepeta authored
      This introduces the new interface for dataflow analysis, where transfer
      functions operate on a whole basic block.
      
      The main changes are:
      - Hoopl.Dataflow: implement the new interface and remove the old code;
        expose a utility function to do a strict fold over the nodes of a
        basic block (for analyses that do want to look at all the nodes)
      - Refactor all the analyses to use the new interface.
      
      One of the nice effects is that we can remove the `analyzeFwdBlocks`
      hack that ignored the middle nodes (that existed for analyses that
      didn't need to go over all the nodes). Now this is no longer a special
      case and fits well with the new interface.
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Test Plan:
      validate, earlier version of the patch had assertions
      comparing the results with the old implementation
      
      Reviewers: erikd, austin, simonmar, hvr, goldfire, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: goldfire, erikd, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2754
      679ccd1c
  9. 02 Nov, 2016 1 commit
    • Michal Terepeta's avatar
      Hoopl/Dataflow: make the module more self-contained · dc4d5962
      Michal Terepeta authored
      This makes the GHC's Dataflow module more self-contained by also
      forking the `DataflowLattice` (instead of only the analysis
      algorithm). Effects/benefits:
      - We no longer need to use the deprecated Hoopl functions (and can
        remove `-fno-warn-warnings-deprecations` from two modules).
      - We can remove the unnecessary `Label` parameter of `JoinFun` (already
        ignored in all our implementations).
      - We no longer mix Hoopl's `Dataflow` module and GHC's one.
      - We can replace some calls to lazy folds in Hoopl with the strict ones
        (see `joinOutFacts` and `mkFactBase`).
      Signed-off-by: Michal Terepeta's avatarMichal Terepeta <michal.terepeta@gmail.com>
      
      Test Plan: validate
      
      Reviewers: austin, simonmar, bgamari
      
      Reviewed By: bgamari
      
      Subscribers: thomie
      
      Differential Revision: https://phabricator.haskell.org/D2660
      dc4d5962
  10. 26 Oct, 2016 1 commit
  11. 22 Oct, 2016 1 commit
  12. 19 Oct, 2016 1 commit
  13. 11 Dec, 2015 1 commit
    • eir@cis.upenn.edu's avatar
      Add kind equalities to GHC. · 67465497
      eir@cis.upenn.edu authored
      This implements the ideas originally put forward in
      "System FC with Explicit Kind Equality" (ICFP'13).
      
      There are several noteworthy changes with this patch:
       * We now have casts in types. These change the kind
         of a type. See new constructor `CastTy`.
      
       * All types and all constructors can be promoted.
         This includes GADT constructors. GADT pattern matches
         take place in type family equations. In Core,
         types can now be applied to coercions via the
         `CoercionTy` constructor.
      
       * Coercions can now be heterogeneous, relating types
         of different kinds. A coercion proving `t1 :: k1 ~ t2 :: k2`
         proves both that `t1` and `t2` are the same and also that
         `k1` and `k2` are the same.
      
       * The `Coercion` type has been significantly enhanced.
         The documentation in `docs/core-spec/core-spec.pdf` reflects
         the new reality.
      
       * The type of `*` is now `*`. No more `BOX`.
      
       * Users can write explicit kind variables in their code,
         anywhere they can write type variables. For backward compatibility,
         automatic inference of kind-variable binding is still permitted.
      
       * The new extension `TypeInType` turns on the new user-facing
         features.
      
       * Type families and synonyms are now promoted to kinds. This causes
         trouble with parsing `*`, leading to the somewhat awkward new
         `HsAppsTy` constructor for `HsType`. This is dispatched with in
         the renamer, where the kind `*` can be told apart from a
         type-level multiplication operator. Without `-XTypeInType` the
         old behavior persists. With `-XTypeInType`, you need to import
         `Data.Kind` to get `*`, also known as `Type`.
      
       * The kind-checking algorithms in TcHsType have been significantly
         rewritten to allow for enhanced kinds.
      
       * The new features are still quite experimental and may be in flux.
      
       * TODO: Several open tickets: #11195, #11196, #11197, #11198, #11203.
      
       * TODO: Update user manual.
      
      Tickets addressed: #9017, #9173, #7961, #10524, #8566, #11142.
      Updates Haddock submodule.
      67465497
  14. 03 Dec, 2015 1 commit
  15. 06 Jan, 2015 1 commit
  16. 13 Nov, 2014 1 commit
  17. 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
  18. 14 May, 2014 1 commit
  19. 20 Jul, 2012 1 commit
  20. 13 Jul, 2012 1 commit
  21. 06 Jul, 2012 1 commit
  22. 05 Jul, 2012 1 commit
  23. 03 Jul, 2012 1 commit
  24. 15 Mar, 2012 1 commit
  25. 26 Jan, 2012 1 commit
  26. 25 Jan, 2012 2 commits
  27. 23 Jan, 2012 2 commits
  28. 20 Jan, 2012 1 commit
  29. 17 Jan, 2012 1 commit