1. 21 Dec, 2017 1 commit
  2. 19 Dec, 2017 1 commit
  3. 17 Oct, 2017 1 commit
  4. 19 Sep, 2017 1 commit
    • Herbert Valerio Riedel's avatar
      compiler: introduce custom "GhcPrelude" Prelude · f63bc730
      Herbert Valerio Riedel authored and Ben Gamari's avatar Ben Gamari committed
      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. 12 Sep, 2017 1 commit
  6. 18 Aug, 2017 1 commit
  7. 31 Jul, 2017 1 commit
    • Simon Peyton Jones's avatar
      Do a bit more CSE · 3ab342eb
      Simon Peyton Jones authored
      I discovered that in
      
         let x = MkT y in ....(MKT y |> co)....
      
      we weren't CSE'ing the (MkT y).  The fix is easy.
      3ab342eb
  8. 17 May, 2017 1 commit
    • Simon Peyton Jones's avatar
      Handle type-lets better · d6461f96
      Simon Peyton Jones authored
      Core allows non-recursive type-lets, thus
      
         let a = TYPE ty in ...
      
      They are substituted away very quickly, but it's convenient for
      some passes to produce them (rather than to have to substitute
      immediately).
      
      Trac #13708 tried the effect of not running the simplifer at all
      (a rather bizarre thing to do, but still).  That showed that some
      passes crashed because they always treated a let-bounder binder
      as an Id.  This patch adds some easy fixes.
      d6461f96
  9. 28 Apr, 2017 1 commit
  10. 02 Apr, 2017 1 commit
  11. 06 Mar, 2017 1 commit
  12. 03 Mar, 2017 1 commit
  13. 01 Mar, 2017 2 commits
  14. 28 Feb, 2017 1 commit
  15. 17 Feb, 2017 1 commit
  16. 04 Feb, 2017 1 commit
  17. 01 Feb, 2017 1 commit
  18. 23 Jan, 2017 1 commit
  19. 20 Jan, 2017 2 commits
    • takano-akio's avatar
      Allow top-level string literals in Core (#8472) · d49b2bb2
      takano-akio authored and Ben Gamari's avatar Ben Gamari committed
      This commits relaxes the invariants of the Core syntax so that a
      top-level variable can be bound to a primitive string literal of type
      Addr#.
      
      This commit:
      
      * Relaxes the invatiants of the Core, and allows top-level bindings whose
        type is Addr# as long as their RHS is either a primitive string literal or
        another variable.
      
      * Allows the simplifier and the full-laziness transformer to float out
        primitive string literals to the top leve.
      
      * Introduces the new StgGenTopBinding type to accomodate top-level Addr#
        bindings.
      
      * Introduces a new type of labels in the object code, with the suffix "_bytes",
        for exported top-level Addr# bindings.
      
      * Makes some built-in rules more robust. This was necessary to keep them
        functional after the above changes.
      
      This is a continuation of D2554.
      
      Rebasing notes:
      This had two slightly suspicious performance regressions:
      
      * T12425: bytes allocated regressed by roughly 5%
      * T4029: bytes allocated regressed by a bit over 1%
      * T13035: bytes allocated regressed by a bit over 5%
      
      These deserve additional investigation.
      
      Rebased by: bgamari.
      
      Test Plan: ./validate --slow
      
      Reviewers: goldfire, trofi, simonmar, simonpj, austin, hvr, bgamari
      
      Reviewed By: trofi, simonpj, bgamari
      
      Subscribers: trofi, simonpj, gridaphobe, thomie
      
      Differential Revision: https://phabricator.haskell.org/D2605
      
      GHC Trac Issues: #8472
      d49b2bb2
    • Simon Peyton Jones's avatar
      Simplify and improve CSE · b78fa759
      Simon Peyton Jones authored
      Trac #13156 showed a lost opportunity for CSE. I found that it was
      easy to fix, and it had the nice side effect of rendering a previous
      nasty case, described in Note [Corner case for case expressions],
      unnecessary.
      
      Simpler code, does more.  Great.
      b78fa759
  20. 05 Jan, 2017 1 commit
    • Simon Peyton Jones's avatar
      Minor refactoring in CSE · c909e6ec
      Simon Peyton Jones authored
      I noticed that CSE.addBinding was always returning one of its own
      inputs, so I refactored to avoid doing so.
      
      No change in behaviour.
      c909e6ec
  21. 21 Dec, 2016 1 commit
    • Simon Peyton Jones's avatar
      Move InId/OutId to CoreSyn · 05d233e8
      Simon Peyton Jones authored
      It turned out that many different modules defined the same type
      synonyms (InId, OutId, InType, OutType, etc) for the same purpose.
      
      This patch is refactoring only: it moves all those definitions to
      CoreSyn.
      05d233e8
  22. 12 Dec, 2016 1 commit
    • Simon Peyton Jones's avatar
      Fix a long-standing bug in CSE · d03dd237
      Simon Peyton Jones authored
      I had the environments wrong so that CSE could mis-clone
      an expression, if the uniques just happened to be badly
      arranged.  It's hard to trigger the bug, so I can't make
      a reliable test case.
      
      Happily the fix is easy.
      d03dd237
  23. 25 May, 2016 1 commit
  24. 06 Apr, 2016 1 commit
  25. 24 Mar, 2016 1 commit
    • Simon Peyton Jones's avatar
      Tidy up handling of coercion variables · cb08f8da
      Simon Peyton Jones authored
      * Comments to explain that a CoVar, whose IdInfo is CoVarId,
        is always unlifted (but may be nominal or representational role)
      
        And TyCoRep.isCoercionType picks out only those unlifted
        types, NOT the lifted versions
      
      * Introduce Var.NcId for non-co-var Ids
        with predicate isNonCoVarId
      
      * Add assertions in CoreSubst that the Id env is only
        used for NcIds
      
      * Fix lurking bug in CSE which extended the
        CoreSubst Id env with a CoVar
      
      * Fix two bugs in Specialise.spec_call, which wrongly treated
        CoVars like NcIds
          - needed a varToCoreExpr in one place
          - needed extendSubst not extendIdSubst in another
        This was the root cause of Trac #11644
      
      Minor refactoring
      
      * Eliminate unused mkDerivedLocalCoVarM, mkUserLocalCoVar
      * Small refactor in mkSysLocalOrCoVar
      cb08f8da
  26. 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
  27. 21 Apr, 2015 1 commit
  28. 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
  29. 19 Jan, 2015 1 commit
  30. 16 Dec, 2014 1 commit
    • Peter Wortmann's avatar
      Source notes (Core support) · 993975d3
      Peter Wortmann authored
      This patch introduces "SourceNote" tickishs that link Core to the
      source code that generated it. The idea is to retain these source code
      links throughout code transformations so we can eventually relate
      object code all the way back to the original source (which we can,
      say, encode as DWARF information to allow debugging).  We generate
      these SourceNotes like other tickshs in the desugaring phase. The
      activating command line flag is "-g", consistent with the flag other
      compilers use to decide DWARF generation.
      
      Keeping ticks from getting into the way of Core transformations is
      tricky, but doable. The changes in this patch produce identical Core
      in all cases I tested -- which at this point is GHC, all libraries and
      nofib. Also note that this pass creates *lots* of tick nodes, which we
      reduce somewhat by removing duplicated and overlapping source
      ticks. This will still cause significant Tick "clumps" - a possible
      future optimization could be to make Tick carry a list of Tickishs
      instead of one at a time.
      
      (From Phabricator D169)
      993975d3
  31. 03 Dec, 2014 1 commit
  32. 19 Sep, 2014 2 commits
  33. 29 Aug, 2014 2 commits
    • Gabor Greif's avatar
      Typos in comments · 9491fea2
      Gabor Greif authored
      9491fea2
    • Simon Peyton Jones's avatar
      Fix a bug in CSE, for INLINE/INLNEABLE things · 4e0e7746
      Simon Peyton Jones authored
      Previusly we simply weren't doing CSE at all on things
      whose unfolding were not always-active, for reasons explained
      in Note [CSE for INLINE and NOINLINE].  But that was bad!
      Making something INLNEABLE meant that its RHS was no longer
      CSE'd, and that made some nofib programs worse.
      
      And it's entirely unnecessary.  I thoguht it through again,
      wrote new comments (under the same Note), and things are
      better again.
      4e0e7746
  34. 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
  35. 12 Nov, 2013 1 commit
    • Simon Peyton Jones's avatar
      Fix egregious omission in CSE (Trac #5996) · 0001d161
      Simon Peyton Jones authored
      This patch fixes a bad omission in CSE, thanks to 'michaelt' for spotting
      it, and correctly identifying the fix (in cseRhs).  The trouble was with
         x1 = C a b
         x2 = C x1 b
         y1 = C a b
         y2 = C y1 b
      we were not commoning up y2=x2, because we failed to substitute y1:=x1,
      so y2's RHS looked different to x2's
      
      I also refactoring, so taht the cs_map in a CSEnv map is
             cs_map    :: CoreMap (OutExpr, Id)
      instead of
             cs_map    :: CoreMap (OutExpr, OutExpr)
      Much nicer!
      
      This doesn't make much difference to allocation, but it gives a surprisingly
      big benefit to binary size.
      
      --------------------------------------------------------------------------------
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
      --------------------------------------------------------------------------------
                 ansi          -1.7%     -0.8%      0.00      0.00     +0.0%
                 bspt          -1.6%     -1.5%      0.01      0.01     +0.0%
            cacheprof          -1.8%     -0.2%     +1.6%     +1.9%     +2.7%
                  fft          -1.4%     -1.3%      0.06      0.06    +11.1%
                  ida          -1.4%     -1.0%      0.12      0.12     +0.0%
                 rfib          -1.4%     -0.1%      0.03      0.03     +0.0%
                  scs          -1.6%     -0.1%     +1.5%     +1.5%     +0.0%
        spectral-norm          -1.3%     -0.1%     -0.2%     -0.2%     +0.0%
                  tak          -1.4%     -0.1%      0.02      0.02     +0.0%
              veritas          -1.4%     -0.1%      0.00      0.00     +0.0%
      --------------------------------------------------------------------------------
                  Min          -2.5%     -1.5%    -11.8%    -11.8%     -8.0%
                  Max          -1.0%     +0.0%     +2.7%     +2.5%    +11.1%
       Geometric Mean          -1.3%     -0.1%     -2.6%     -2.6%     +0.0%
      0001d161
  36. 06 Jun, 2013 1 commit