Skip to content
Snippets Groups Projects
  1. Jul 14, 2019
    • John Ericson's avatar
      Expunge #ifdef and #ifndef from the codebase · d7c6c471
      John Ericson authored and Marge Bot's avatar Marge Bot committed
      These are unexploded minds as far as the linter is concerned. I don't
      want to hit in my MRs by mistake!
      
      I did this with `sed`, and then rolled back some changes in the docs,
      config.guess, and the linter itself.
      d7c6c471
  2. Jul 10, 2019
    • Simon Peyton Jones's avatar
      Fix erroneous float in CoreOpt · d2e290d3
      Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
      The simple optimiser was making an invalid transformation
      to join points -- yikes.  The fix is easy.
      
      I also added some documentation about the fact that GHC uses
      a slightly more restrictive version of join points than does
      the paper.
      
      Fix #16918
      d2e290d3
  3. Jun 21, 2019
  4. Jun 16, 2019
  5. Jun 09, 2019
  6. May 31, 2019
    • Ömer Sinan Ağacan's avatar
      Fix arity type of coerced types in CoreArity · bb929009
      Ömer Sinan Ağacan authored and Marge Bot's avatar Marge Bot committed
      Previously if we had
      
          f |> co
      
      where `f` had arity type `ABot N` and `co` had arity M and M < N,
      `arityType` would return `ABot M` which is wrong, because `f` is only
      known to diverge when applied to `N` args, as described in Note
      [ArityType]:
      
          If at = ABot n, then (f x1..xn) definitely diverges. Partial
          applications to fewer than n args may *or may not* diverge.
      
      This caused incorrect eta expansion in the simplifier, causing #16066.
      
      We now return `ATop M` for the same expression so the simplifier can't
      assume partial applications of `f |> co` is divergent.
      
      A regression test T16066 is also added.
      bb929009
  7. May 26, 2019
    • isovector's avatar
      Let the specialiser work on dicts under lambdas · 2d0cf625
      isovector authored and Marge Bot's avatar Marge Bot committed
      Following the discussion under #16473, this change allows the
      specializer to work on any dicts in a lambda, not just those that occur
      at the beginning.
      
      For example, if you use data types which contain dictionaries and
      higher-rank functions then once these are erased by the optimiser you
      end up with functions such as:
      
      ```
        go_s4K9
        Int#
        -> forall (m :: * -> *).
           Monad m =>
           (forall x. Union '[State (Sum Int)] x -> m x) -> m ()
      ```
      
      The dictionary argument is after the Int# value argument, this patch
      allows `go` to be specialised.
      2d0cf625
  8. Mar 22, 2019
  9. Mar 20, 2019
  10. Mar 15, 2019
  11. Mar 08, 2019
    • Sebastian Graf's avatar
      Always do the worker/wrapper split for NOINLINEs · 1675d40a
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      Trac #10069 revealed that small NOINLINE functions didn't get split
      into worker and wrapper. This was due to `certainlyWillInline`
      saying that any unfoldings with a guidance of `UnfWhen` inline
      unconditionally. That isn't the case for NOINLINE functions, so we
      catch this case earlier now.
      
      Nofib results:
      
      --------------------------------------------------------------------------------
              Program         Allocs    Instrs
      --------------------------------------------------------------------------------
       fannkuch-redux          -0.3%      0.0%
                   gg          +0.0%     +0.1%
             maillist          -0.2%     -0.2%
              minimax           0.0%     -0.8%
      --------------------------------------------------------------------------------
                  Min          -0.3%     -0.8%
                  Max          +0.0%     +0.1%
       Geometric Mean          -0.0%     -0.0%
      
      Fixes #10069.
      
      -------------------------
      Metric Increase:
          T9233
      -------------------------
      1675d40a
  12. Mar 05, 2019
  13. Mar 01, 2019
  14. Feb 22, 2019
    • Simon Peyton Jones's avatar
      Fix exprIsConApp_maybe · c25b135f
      Simon Peyton Jones authored and Matthew Pickering's avatar Matthew Pickering committed
      In this commit
         commit 7833cf40
         Date:   Thu Jan 24 17:58:50 2019 +0100
            Look through newtype wrappers (Trac #16254)
      
      we made exprIsConApp_maybe quite a bit cleverer.  But I had not paid
      enough attention to keeping exactly the correct substitution and
      in-scope set, which led to Trac #16348.
      
      There were several buglets (like applying the substitution twice in
      exprIsConApp_maybe, but the proximate source of the bug was that we were
      calling addNewInScopeIds, which deleted things from the substitution as
      well as adding them to the in-scope set.  That's usually right, but not
      here!
      
      This was quite tricky to track down.  But it is nicer now.
      c25b135f
  15. Feb 19, 2019
  16. Feb 01, 2019
  17. Jan 30, 2019
  18. Dec 25, 2018
    • Ben Gamari's avatar
      testsuite: Fix a variety of issues when building with integer-simple · 99378207
      Ben Gamari authored
       * Mark arith011 as broken with integer-simple
      
         As noted in #16091, arith011 fails when run against integer-simple with a
         "divide by zero" exception. This suggests that integer-gmp and integer-simple
         are handling division by zero differently.
      
       * This also fixes broken_without_gmp; the lack of types made the previous
         failure silent, sadly. Improves situation of #16043.
      
       * Mark several tests implicitly depending upon integer-gmp as broken
         with integer-simple. These expect to see Core coming from integer-gmp,
         which breaks with integer-simple.
      
       * Increase runtime timeout multiplier of T11627a with integer-simple
      
         I previously saw that T11627a timed out in all profiling ways when run against
         integer-simple. I suspect this is due to integer-simple's rather verbose heap
         representation. Let's see whether increasing the runtime timeout helps.
      
         Fixes test for #11627.
      
      This is all in service of fixing #16043.
      99378207
  19. Dec 24, 2018
    • Ömer Sinan Ağacan's avatar
      Simplify Core output with -dsuppress-type-signatures · 8a0fca09
      Ömer Sinan Ağacan authored
      Currently we duplicate top-level binder ids for no reason:
      
          $fEqHsExpr_$c/=
          $fEqHsExpr_$c/=
            = \ @ id_a27U $dEq_a27V eta_B2 eta1_B1 ->
                case $fEqHsExpr_$c== $dEq_a27V eta_B2 eta1_B1 of {
                  False -> True;
                  True -> False
                }
      
      with this patch we drop the first line when type signatures are not
      printed (-dsuppress-type-signatures, which is implied by -dsuppress-all)
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5472
      8a0fca09
  20. Dec 22, 2018
  21. Dec 12, 2018
    • Simon Peyton Jones's avatar
      Improvements to demand analysis · d77501cd
      Simon Peyton Jones authored
      This patch collects a few improvements triggered by Trac #15696,
      and fixing Trac #16029
      
      * Stop making toCleanDmd behave specially for unlifted types.
        This special case was the cause of stupid behaviour in Trac
        #16029.  And to my joy I discovered the let/app invariant
        rendered it unnecessary.  (Maybe the special case pre-dated
        the let/app invariant.)
      
        Result: less special-case handling in the compiler, and
        better perf for the compiled code.
      
      * In WwLib.mkWWstr_one, treat seqDmd like U(AAA).  It was not
        being so treated before, which again led to stupid code.
      
      * Update and improve Notes
      
      There are .stderr test wibbles because we get slightly different
      strictness signatures for an argumment of unlifted type:
          <L,U> rather than <S,U>        for Int#
          <S,U> rather than <S(S),U(U)>  for Int
      d77501cd
  22. Nov 19, 2018
    • Sebastian Graf's avatar
      Don't track free variables in STG syntax by default · 47bbc709
      Sebastian Graf authored
      Summary:
      Currently, `CoreToStg` annotates `StgRhsClosure`s with their set of non-global
      free variables.  This free variable information is only needed in the final
      code generation step (i.e. `StgCmm.codeGen`), which leads to transformations
      such as `StgCse` and `StgUnarise` having to maintain this information.
      
      This is tiresome and unnecessary, so this patch introduces a trees-to-grow-like
      approach that only introduces the free variable set into the syntax tree in the
      code gen pass, along with a free variable analysis on STG terms to generate
      that information.
      
      Fixes #15754.
      
      Reviewers: simonpj, osa1, bgamari, simonmar
      
      Reviewed By: osa1
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15754
      
      Differential Revision: https://phabricator.haskell.org/D5324
      47bbc709
  23. Nov 07, 2018
    • davide's avatar
      testsuite: Save performance metrics in git notes. · 932cd41d
      davide authored
      This patch makes the following improvement:
        - Automatically records test metrics (per test environment) so that
          the programmer need not supply nor update expected values in *.T
          files.
          - On expected metric changes, the programmer need only indicate the
            direction of change in the git commit message.
        - Provides a simple python tool "perf_notes.py" to compare metrics
          over time.
      
      Issues:
        - Using just the previous commit allows performance to drift with each
          commit.
          - Currently we allow drift as we have a preference for minimizing
            false positives.
          - Some possible alternatives include:
            - Use metrics from a fixed commit per test: the last commit that
              allowed a change in performance (else the oldest metric)
            - Or use some sort of aggregate since the last commit that allowed
              a change in performance (else all available metrics)
            - These alternatives may result in a performance issue (with the
              test driver) having to heavily search git commits/notes.
        - Run locally, performance tests will trivially pass unless the tests
          were run locally on the previous commit. This is often not the case
          e.g.  after pulling recent changes.
      
      Previously, *.T files contain statements such as:
      ```
      stats_num_field('peak_megabytes_allocated', (2, 1))
      compiler_stats_num_field('bytes allocated',
                               [(wordsize(64), 165890392, 10)])
      ```
      This required the programmer to give the expected values and a tolerance
      deviation (percentage). With this patch, the above statements are
      replaced with:
      ```
      collect_stats('peak_megabytes_allocated', 5)
      collect_compiler_stats('bytes allocated', 10)
      ```
      So that programmer must only enter which metrics to test and a tolerance
      deviation. No expected value is required. CircleCI will then run the
      tests per test environment and record the metrics to a git note for that
      commit and push them to the git.haskell.org ghc repo. Metrics will be
      compared to the previous commit. If they are different by the tolerance
      deviation from the *.T file, then the corresponding test will fail. By
      adding to the git commit message e.g.
      ```
       # Metric (In|De)crease <metric(s)> <options>: <tests>
      Metric Increase ['bytes allocated', 'peak_megabytes_allocated'] \
               (test_env='linux_x86', way='default'):
          Test012, Test345
      Metric Decrease 'bytes allocated':
          Test678
      Metric Increase:
          Test711
      ```
      This will allow the noted changes (letting the test pass). Note that by
      omitting metrics or options, the change will apply to all possible
      metrics/options (i.e. in the above, an increase for all metrics in all
      test environments is allowed for Test711)
      
      phabricator will use the message in the description
      
      Reviewers: bgamari, hvr
      
      Reviewed By: bgamari
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #12758
      
      Differential Revision: https://phabricator.haskell.org/D5059
      932cd41d
  24. Oct 15, 2018
    • Vladislav Zavialov's avatar
      Enable -Wcompat=error in the testsuite · 165d3d5d
      Vladislav Zavialov authored and Ben Gamari's avatar Ben Gamari committed
      Enabling -Werror=compat in the testsuite allows us to easily see the
      impact that a new warning has on code. It also means that in the period
      between adding the warning and making the actual breaking change, all
      new test cases that are being added to the testsuite will be
      forwards-compatible. This is good because it will make the actual
      breaking change contain less irrelevant testsuite updates.
      
      Things that -Wcompat warns about are things that are going to break in
      the future, so we can be proactive and keep our testsuite
      forwards-compatible.
      
      This patch consists of two main changes:
      
      * Add `TEST_HC_OPTS += -Werror=compat` to the testsuite configuration.
      * Fix all broken test cases.
      
      Test Plan: Validate
      
      Reviewers: hvr, goldfire, bgamari, simonpj, RyanGlScott
      
      Reviewed By: goldfire, RyanGlScott
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15278
      
      Differential Revision: https://phabricator.haskell.org/D5200
      165d3d5d
    • Tamar Christina's avatar
      Fix plugin tests requirements · 01c3d00a
      Tamar Christina authored and Ben Gamari's avatar Ben Gamari committed
      Unfortunately the implementation has confused the ability to make
      dynamic libraries with dynamic way.
      This constraint is only true for systems that require `-fPIC` for
      shared libraries.
      
      Since the implementation has this implicit assumption, mark the tests
      as requiring dynway.
      
      Test Plan: ./validate
      
      Reviewers: bgamari
      
      Reviewed By: bgamari
      
      Subscribers: simonpj, rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5174
      01c3d00a
  25. Sep 26, 2018
    • Simon Peyton Jones's avatar
      Fix constant-folding for Integer shifts · d25fa45e
      Simon Peyton Jones authored
      In this patch
          commit 869f69fd
          Author: Simon Peyton Jones <simonpj@microsoft.com>
          Date:   Wed Dec 11 18:19:34 2013 +0000
      
          Guarding against silly shifts
      
      we deal with silly shifts like (Sll 1 9223372036854775807).  But
      I only dealt with primops that Int# and Word#.
      
      Alas, the same problem affects shifts of Integer, as Trac #15673
      showed.  Fortunately, the problem is easy to fix.
      d25fa45e
  26. Sep 13, 2018
  27. Sep 12, 2018
    • Simon Peyton Jones's avatar
      Be a bit more aggressive about let-to-case · 0e6d42fe
      Simon Peyton Jones authored
      This patch takes up the missed opportunity described in
      Trac #15631, by convering a case into a let slightly
      more agressively. See Simplify.hs
      Note [Case-to-let for strictly-used binders]
      
      There is no measurable perf impact for good or ill. But
      the code is simpler and easier to explain.
      0e6d42fe
  28. Sep 05, 2018
    • Simon Peyton Jones's avatar
      Preserve specialisations despite CSE · 3addf72a
      Simon Peyton Jones authored
      Trac #15445 showed that, as a result of CSE, a function with an
      automatically generated specialisation RULE could be inlined
      before the RULE had a chance to fire.
      
      This patch attaches a NOINLINE[2] activation to the Id, during
      CSE, to stop this happening.
      
      See Note [Delay inlining after CSE]
      
      ---- Historical note ---
      
      This patch is simpler and more direct than an earlier
      version:
      
        commit 2110738b
        Author: Simon Peyton Jones <simonpj@microsoft.com>
        Date:   Mon Jul 30 13:43:56 2018 +0100
      
        Don't inline functions with RULES too early
      
      We had to revert this patch because it made GHC itself slower.
      
      Why? It delayed inlining of /all/ functions with RULES, and that was
      very bad in TcFlatten.flatten_ty_con_app
      
      * It delayed inlining of liftM
      * That delayed the unravelling of the recursion in some dictionary
        bindings.
      * That delayed some eta expansion, leaving
           flatten_ty_con_app = \x y. let <stuff> in \z. blah
      * That allowed the float-out pass to put sguff between
        the \y and \z.
      * And that permanently stopped eta expasion of the function,
        even once <stuff> was simplified.
      
      -- End of historical note ---
      3addf72a
  29. Aug 27, 2018
    • Ryan Scott's avatar
      Take strict fields into account in coverage checking · 744b034d
      Ryan Scott authored and Krzysztof Gogolewski's avatar Krzysztof Gogolewski committed
      Summary:
      The current pattern-match coverage checker implements the
      formalism presented in the //GADTs Meet Their Match// paper in a
      fairly faithful matter. However, it was discovered recently that
      there is a class of unreachable patterns that
      //GADTs Meet Their Match// does not handle: unreachable code due to
      strict argument types, as demonstrated in #15305. This patch
      therefore goes off-script a little and implements an extension to
      the formalism presented in the paper to handle this case.
      
      Essentially, when determining if each constructor can be matched on,
      GHC checks if its associated term and type constraints are
      satisfiable. This patch introduces a new form of constraint,
      `NonVoid(ty)`, and checks if each constructor's strict argument types
      satisfy `NonVoid`. If any of them do not, then that constructor is
      deemed uninhabitable, and thus cannot be matched on. For the full
      story of how this works, see
      `Note [Extensions to GADTs Meet Their Match]`.
      
      Along the way, I did a little bit of much-needed refactoring. In
      particular, several functions in `Check` were passing a triple of
      `(ValAbs, ComplexEq, Bag EvVar)` around to represent a constructor
      and its constraints. Now that we're adding yet another form of
      constraint to the mix, I thought it appropriate to turn this into
      a proper data type, which I call `InhabitationCandidate`.
      
      Test Plan: make test TEST=T15305
      
      Reviewers: simonpj, bgamari
      
      Reviewed By: simonpj
      
      Subscribers: rwbarton, carter
      
      GHC Trac Issues: #15305
      
      Differential Revision: https://phabricator.haskell.org/D5087
      744b034d
  30. Aug 21, 2018
    • Simon Peyton Jones's avatar
      Set strictness correctly for JoinIds · ce6ce788
      Simon Peyton Jones authored
      We were failing to keep correct strictness info when eta-expanding
      join points; Trac #15517.   The situation was something like
      
        \q v eta ->
           let j x = error "blah
               -- STR Lx   bottoming!
           in case y of
                 A -> j x eta
                 B -> blah
                 C -> j x eta
      
      So we spot j as a join point and eta-expand it.  But we must
      also adjust the stricness info, else it vlaimes to bottom after
      one arg is applied but now it has become two.
      
      I fixed this in two places:
      
       - In CoreOpt.joinPointBinding_maybe, adjust strictness info
      
       - In SimplUtils.tryEtaExpandRhs, return consistent values
         for arity and bottom-ness
      ce6ce788
  31. Aug 18, 2018
  32. Aug 12, 2018
  33. Aug 11, 2018
    • Krzysztof Gogolewski's avatar
      Simplify testsuite driver · f27d7145
      Krzysztof Gogolewski authored
      Summary:
      - remove clean_cmd
      - framework_failures was undefined
      - times_file was not used
      - if_verbose_dump was called only when verbose >= 1; remove the check
      - simplify normalise_whitespace
      
      Test Plan: validate
      
      Reviewers: bgamari, thomie
      
      Reviewed By: thomie
      
      Subscribers: rwbarton, carter
      
      Differential Revision: https://phabricator.haskell.org/D5061
      f27d7145
Loading