1. 22 Apr, 2022 16 commits
  2. 21 Apr, 2022 1 commit
  3. 20 Apr, 2022 4 commits
    • Simon Peyton Jones's avatar
      Fix substitution in bindAuxiliaryDict · 0c02c919
      Simon Peyton Jones authored and  Marge Bot's avatar Marge Bot committed
      In GHC.Core.Opt.Specialise.bindAuxiliaryDict we were unnecessarily
      calling `extendInScope` to bring into scope variables that were
      /already/ in scope.  Worse, GHC.Core.Subst.extendInScope strangely
      deleted the newly-in-scope variables from the substitution -- and that
      was fatal in #21391.
      I removed the redundant calls to extendInScope.
      More ambitiously, I changed GHC.Core.Subst.extendInScope (and cousins)
      to stop deleting variables from the substitution.  I even changed the
      names of the function to extendSubstInScope (and cousins) and audited
      all the calls to check that deleting from the substitution was wrong.
      In fact there are very few such calls, and they are all about
      introducing a fresh non-in-scope variable.  These are "OutIds"; it is
      utterly wrong to mess with the "InId" substitution.
      I have not added a Note, because I'm deleting wrong code, and it'd be
      distracting to document a bug.
    • Andreas Klebinger's avatar
      Fix a shadowing issue in StgUnarise. · 49bd7584
      Andreas Klebinger authored and  Marge Bot's avatar Marge Bot committed
      For I assume performance reasons we don't record no-op replacements
      during unarise. This lead to problems with code like this:
          f = \(Eta_B0 :: VoidType) x1 x2 ->
             ... let foo = \(Eta_B0 :: LiftedType) -> g x y Eta_B0
                 in ...
      Here we would record the outer Eta_B0 as void rep, but would not
      shadow Eta_B0 inside `foo` because this arg is single-rep and so
      doesn't need to replaced. But this means when looking at occurence
      sites we would check the env and assume it's void rep based on the
      entry we made for the (no longer in scope) outer `Eta_B0`.
      Fixes #21396 and the ticket has a few more details.
    • Krzysztof Gogolewski's avatar
      Remove LevityInfo · a5ea65c9
      Krzysztof Gogolewski authored and  Marge Bot's avatar Marge Bot committed
      Every Id was storing a boolean whether it could be levity-polymorphic.
      This information is no longer needed since representation-checking
      has been moved to the typechecker.
    • Alan Zimmerman's avatar
      Add -dkeep-comments flag to keep comments in the parser · 83c67f76
      Alan Zimmerman authored and  Marge Bot's avatar Marge Bot committed
      This provides a way to set the Opt_KeepRawTokenStream from the command
      line, allowing exact print annotation users to see exactly what is
      produced for a given parsed file, when used in conjunction with
      Discussed in #19706, but this commit does not close the issue.
  4. 15 Apr, 2022 3 commits
  5. 14 Apr, 2022 2 commits
  6. 13 Apr, 2022 1 commit
  7. 12 Apr, 2022 4 commits
    • Sebastian Graf's avatar
      Specialise: Check `typeDeterminesValue` before specialising on an interesting dictionary · b06f4f47
      Sebastian Graf authored
      I extracted the checks from `Note [Type determines value]` into its own
      function, so that we share the logic properly. Then I made sure that we
      actually call `typeDeterminesValue` everywhere we check for `interestingDict`.
    • Sebastian Graf's avatar
      Specialising through specialised method calls (#19644) · 4d2ee313
      Sebastian Graf authored
      In #19644, we discovered that the ClassOp/DFun rules from
      Note [ClassOp/DFun selection] inhibit transitive specialisation in a scenario
      class C a where m :: Show b => a -> b -> ...; n :: ...
      instance C Int where m = ... -- $cm :: Show b => Int -> b -> ...
      f :: forall a b. (C a, Show b) => ...
      f $dC $dShow = ... m @a $dC @b $dShow ...
      main = ... f @Int @Bool ...
      After we specialise `f` for `Int`, we'll see `m @a $dC @b $dShow` in the body of
      `$sf`. But before this patch, Specialise doesn't apply the ClassOp/DFun rule to
      rewrite to a call of the instance method for `C Int`, e.g., `$cm @Bool $dShow`.
      As a result, Specialise couldn't further specialise `$cm` for `Bool`.
      There's a better example in `Note [Specialisation modulo dictionary selectors]`.
      This patch enables proper Specialisation, as follows:
      1. In the App case of `specExpr`, try to apply the CalssOp/DictSel rule on the
         head of the application
      2. Attach an unfolding to freshly-bound dictionary ids such as `$dC` and
         `$dShow` in `bindAuxiliaryDict`
      NB: Without (2), (1) would be pointless, because `lookupRule` wouldn't be able
      to look into the RHS of `$dC` to see the DFun.
      (2) triggered #21332, because the Specialiser floats around dictionaries without
      accounting for them in the `SpecEnv`'s `InScopeSet`, triggering a panic when
      rewriting dictionary unfoldings.
      Fixes #19644 and #21332.
    • Sebastian Graf's avatar
      Eta reduction based on evaluation context (#21261) · 0090ad7b
      Sebastian Graf authored and  Marge Bot's avatar Marge Bot committed
      I completely rewrote our Notes surrounding eta-reduction. The new entry point is
      `Note [Eta reduction makes sense]`.
      Then I went on to extend the Simplifier to maintain an evaluation context in the
      form of a `SubDemand` inside a `SimplCont`. That `SubDemand` is useful for doing
      eta reduction according to `Note [Eta reduction based on evaluation context]`,
      which describes how Demand analysis, Simplifier and `tryEtaReduce` interact to
      facilitate eta reduction in more scenarios.
      Thus we fix #21261.
      ghc/alloc perf marginally improves (-0.0%). A medium-sized win is when compiling
      T3064 (-3%). It seems that haddock improves by 0.6% to 1.0%, too.
      Metric Decrease:
    • Hécate Moonlight's avatar
      Document that DuplicateRecordFields doesn't tolerates ambiguous fields · 5440f63e
      Hécate Moonlight authored and  Marge Bot's avatar Marge Bot committed
      Fix #19891
  8. 09 Apr, 2022 9 commits
    • Vladislav Zavialov's avatar
      Refactor: simplify lexing of the dot · 20eca489
      Vladislav Zavialov authored and  Marge Bot's avatar Marge Bot committed
      Before this patch, the lexer did a truly roundabout thing with the dot:
      1. look up the varsym in reservedSymsFM and turn it into ITdot
      2. under OverloadedRecordDot, turn it into ITvarsym
      3. in varsym_(prefix|suffix|...) turn it into ITvarsym, ITdot, or
         ITproj, depending on extensions and whitespace
      Turns out, the last step is sufficient to handle the dot correctly.
      This patch removes the first two steps.
    • sheaf's avatar
      Fix missing SymCo in pushCoercionIntoLambda · 5f8d6e65
      sheaf authored and  Marge Bot's avatar Marge Bot committed
      There was a missing SymCo in pushCoercionIntoLambda. Currently
      this codepath is only used with rewrite rules, so this bug managed
      to slip by, but trying to use pushCoercionIntoLambda in other contexts
      revealed the bug.
    • Andreas Klebinger's avatar
      Add regression test for #19569 · 47d18b0b
      Andreas Klebinger authored and  Marge Bot's avatar Marge Bot committed
    • Phil Hazelden's avatar
      Update changelog. · 20bbf3ac
      Phil Hazelden authored and  Marge Bot's avatar Marge Bot committed
    • Phil Hazelden's avatar
      Add tests for several trace functions. · 8fafacf7
      Phil Hazelden authored and  Marge Bot's avatar Marge Bot committed
    • Phil Hazelden's avatar
    • Joachim Breitner's avatar
      Drop the app invariant · dcf30da8
      Joachim Breitner authored and  Marge Bot's avatar Marge Bot committed
      previously, GHC had the "let/app-invariant" which said that the RHS of a
      let or the argument of an application must be of lifted type or ok for
      speculation. We want this on let to freely float them around, and we
      wanted that on app to freely convert between the two (e.g. in
      beta-reduction or inlining).
      However, the app invariant meant that simple code didn't stay simple and
      this got in the way of rules matching. By removing the app invariant,
      this thus fixes #20554
      The new invariant is now called "let-can-float invariant", which is
      hopefully easier to guess its meaning correctly.
      Dropping the app invariant means that everywhere where we effectively do
      beta-reduction (in the two simplifiers, but also in `exprIsConApp_maybe`
      and other innocent looking places) we now have to check if the argument
      must be evaluated (unlifted and side-effecting), and analyses have to be
      adjusted to the new semantics of `App`.
      Also, `LetFloats` in the simplifier can now also carry such non-floating
      The fix for DmdAnal, refine by Sebastian, makes functions with unlifted
      arguments strict in these arguments, which changes some signatures.
      This causes some extra calls to `exprType` and `exprOkForSpeculation`,
      so some perf benchmarks regress a bit (while others improve).
      Metric Decrease:
      Metric Increase:
      Co-authored-by: Sebastian Graf's avatarSebastian Graf <sebastian.graf@kit.edu>
    • Matthew Pickering's avatar
      Bump deepseq to · 27362265
      Matthew Pickering authored and  Marge Bot's avatar Marge Bot committed
      Updates deepseq submodule
      Fixes #20653
    • Matthew Pickering's avatar
      ci: Remove doc-tarball dependency from perf and perf-nofib jobs · 3c48e12a
      Matthew Pickering authored and  Marge Bot's avatar Marge Bot committed
      These don't depend on the contents of the tarball so we can run them
      straight after the fedora33 job finishes.