1. 19 Jun, 2021 9 commits
  2. 18 Jun, 2021 4 commits
    • Gleb Popov's avatar
      Pass -DLIBICONV_PLUG when building base library on FreeBSD. · 5d3d9925
      Gleb Popov authored
      If libiconv is installed from packages on the build machine, there is a high
      chance that the build system will pick up /usr/local/include/iconv.h instead
      of base /usr/include/iconv.h
      
      This additional preprocessor define makes package's libiconv header compatible
      with system one, fixing the build.
      
      Closes issue #19958
      5d3d9925
    • Simon Peyton Jones's avatar
      Improve pretty-printing of coercions · db7e6dc5
      Simon Peyton Jones authored
      With -dsuppress-coercions, it's still good to be able to see the
      type of the coercion. This patch prints the type.  Maybe we should
      have a flag to control this too.
      db7e6dc5
    • Simon Peyton Jones's avatar
      Improve abstractVars quantification ordering · c6a00c15
      Simon Peyton Jones authored
      When floating a binding out past some type-variable binders,
      don't gratuitiously change the order of the binders.
      
      This small change gives code that is simpler, has less risk of
      non-determinism, and does not gratuitiously change type-variable
      order.
      
      See Note [Which type variables to abstract over] in
      GHC.Core.Opt.Simplify.Utils.
      
      This is really just refactoring; no change in behaviour.
      c6a00c15
    • Simon Peyton Jones's avatar
      Enhance cast worker/wrapper for INLINABLE · 3b783496
      Simon Peyton Jones authored
      In #19890 we realised that cast worker/wrapper didn't really work
      properly for functions with an INLINABLE pragma, and hence a stable
      unfolding. This patch fixes the problem.
      
      Instead of disabling cast w/w when there is a stable unfolding (as
      we did before), we now tranfer the stable unfolding to the worker.
      
      It turned out that it was easier to do that if I moved the cast
      w/w stuff from prepareBinding to completeBind.
      
      No chnages at all in nofib results:
      --------------------------------------------------------------------------------
              Program           Size    Allocs   Runtime   Elapsed  TotalMem
      --------------------------------------------------------------------------------
                  Min          -0.0%      0.0%    -63.8%    -78.2%      0.0%
                  Max          -0.0%      0.0%    +11.8%    +11.7%      0.0%
       Geometric Mean          -0.0%     -0.0%    -26.6%    -33.4%     -0.0%
      
      Small decreases in compile-time allocation for two tests (below)
      of around 2%.
      
      T12545 increased in compile-time alloc by 4%, but it's not
      reproducible on my machine, and is a known-wobbly test.
      
      Metric Increase:
          T12545
      
      Metric Decrease:
          T18698a
          T18698b
      3b783496
  3. 17 Jun, 2021 8 commits
  4. 16 Jun, 2021 1 commit
  5. 10 Jun, 2021 6 commits
    • Simon Peyton Jones's avatar
      Fix INLINE pragmas in desugarer · 3d5cb335
      Simon Peyton Jones authored
      In #19969 we discovered that GHC has has a bug *forever* that means it
      sometimes essentially discarded INLINE pragams.  This happened when you have
      * Two more more mutually recursive functions
      * Some of which (presumably not all!) have an INLINE pragma
      * Completely monomorphic.
      
      This hits a particular case in GHC.HsToCore.Binds.dsAbsBinds, which was
      simply wrong -- it put the INLINE pragma on the wrong binder.
      
      This patch fixes the bug, rather easily, by adjusting the
      no-tyvar, no-dict case of GHC.HsToCore.Binds.dsAbsBinds.
      
      I also discovered that the GHC.Core.Opt.Pipeline.shortOutIndirections
      was not doing a good job for
      
          {-# INLINE lcl_id #-}
          lcl_id = BIG
      
          gbl_id = lcl_id
      
      Here we want to transfer the stable unfolding to gbl_id (we do), but
      we also want to remove it from lcl_id (we were not doing that).
      Otherwise both Ids have large stable unfoldings.  Easily fixed.
      Note [Transferring IdInfo] explains.
      3d5cb335
    • sheaf's avatar
      Reword: representation instead of levity · 472c2bf0
      sheaf authored
      fixes #19756, updates haddock submodule
      472c2bf0
    • Sylvain Henry's avatar
      Fix redundant import · 61c51c00
      Sylvain Henry authored
      61c51c00
    • Matthew Pickering's avatar
      Add (broken) test for #19966 · fb6b6379
      Matthew Pickering authored
      fb6b6379
    • Xia Li-yao's avatar
    • Simon Peyton Jones's avatar
      Do not add unfoldings to lambda-binders · f4a5e30e
      Simon Peyton Jones authored
      For reasons described in GHC.Core.Opt.Simplify
      Historical Note [Case binders and join points],
      we used to keep a Core unfolding in one of the lambda-binders
      for a join point.  But this was always a gross hack -- it's
      very odd to have an unfolding in a lambda binder, that refers to
      earlier lambda binders.
      
      The hack bit us in various ways:
      * Most seriously, it is incompatible with linear types in Core.
      * It complicated demand analysis, and could worsen results
      * It required extra care in the simplifier (simplLamBinder)
      * It complicated !5641 (look for "join binder unfoldings")
      
      So this patch just removes the hack.  Happily, doind so turned out to
      have no effect on performance.
      f4a5e30e
  6. 09 Jun, 2021 2 commits
  7. 08 Jun, 2021 1 commit
  8. 07 Jun, 2021 5 commits
    • Ryan Scott's avatar
      Introduce `hsExprType :: HsExpr GhcTc -> Type` in the new module · 7ea3b7eb
      Ryan Scott authored
      
      `GHC.Hs.Syn.Type`
      
      The existing `hsPatType`, `hsLPatType` and `hsLitType` functions have also been
      moved to this module
      
      This is a less ambitious take on the same problem that !2182 and !3866
      attempt to solve. Rather than have the `hsExprType` function attempt to
      efficiently compute the `Type` of every subexpression in an `HsExpr`, this
      simply computes the overall `Type` of a single `HsExpr`.
      
      - Explicitly forbids the `SplicePat` `HsIPVar`, `HsBracket`, `HsRnBracketOut`
        and `HsTcBracketOut` constructors during the typechecking phase by using
        `Void` as the TTG extension field
      - Also introduces `dataConCantHappen` as a domain specific alternative to `absurd`
        to handle cases where the TTG extension points forbid a constructor.
      - Turns HIE file generation into a pure function that doesn't need access to the
        `DsM` monad to compute types, but uses `hsExprType` instead.
      - Computes a few more types during HIE file generation
      - Makes GHCi's `:set +c` command also use `hsExprType` instead of going through
        the desugarer to compute types.
      
      Updates haddock submodule
      Co-authored-by: Zubin's avatarZubin Duggal <zubin.duggal@gmail.com>
      7ea3b7eb
    • vdukhovni's avatar
      Small ZipList optimisation · 9e724f6e
      vdukhovni authored
      In (<|>) for ZipList, avoid processing the first argument twice (both as first
      argument of (++) and for its length in drop count of the second argument).
      
      Previously, the entire first argument was forced into memory, now (<|>) can run
      in constant space even with long inputs.
      9e724f6e
    • Sylvain Henry's avatar
      Bump haddock submodule · 40c0f67f
      Sylvain Henry authored
      40c0f67f
    • Sylvain Henry's avatar
      Parser: make less DynFlags dependent · 3a90814f
      Sylvain Henry authored
      This is an attempt at reducing the number of dependencies of the Parser
      (as reported by CountParserDeps). Modules in GHC.Parser.* don't import
      GHC.Driver.Session directly anymore.
      
      Sadly some GHC.Driver.* modules are still transitively imported and the
      number of dependencies didn't decrease. But it's a step in the right
      direction.
      3a90814f
    • Sylvain Henry's avatar
      Make Logger independent of DynFlags · 4dc681c7
      Sylvain Henry authored
      Introduce LogFlags as a independent subset of DynFlags used for logging.
      As a consequence in many places we don't have to pass both Logger and
      DynFlags anymore.
      
      The main reason for this refactoring is that I want to refactor the
      systools interfaces: for now many systools functions use DynFlags both
      to use the Logger and to fetch their parameters (e.g. ldInputs for the
      linker). I'm interested in refactoring the way they fetch their
      parameters (i.e. use dedicated XxxOpts data types instead of DynFlags)
      for #19877. But if I did this refactoring before refactoring the Logger,
      we would have duplicate parameters (e.g. ldInputs from DynFlags and
      linkerInputs from LinkerOpts). Hence this patch first.
      
      Some flags don't really belong to LogFlags because they are subsystem
      specific (e.g. most DumpFlags). For example -ddump-asm should better be
      passed in NCGConfig somehow. This patch doesn't fix this tight coupling:
      the dump flags are part of the UI but they are passed all the way down
      for example to infer the file name for the dumps.
      
      Because LogFlags are a subset of the DynFlags, we must update the former
      when the latter changes (not so often). As a consequence we now use
      accessors to read/write DynFlags in HscEnv instead of using `hsc_dflags`
      directly.
      
      In the process I've also made some subsystems less dependent on DynFlags:
      
      - CmmToAsm: by passing some missing flags via NCGConfig (see new fields
        in GHC.CmmToAsm.Config)
      - Core.Opt.*:
          - by passing -dinline-check value into UnfoldingOpts
          - by fixing some Core passes interfaces (e.g. CallArity, FloatIn)
            that took DynFlags argument for no good reason.
          - as a side-effect GHC.Core.Opt.Pipeline.doCorePass is much less
            convoluted.
      4dc681c7
  9. 05 Jun, 2021 4 commits
    • Ben Gamari's avatar
      testsuite: Fix Note style · 5e1a2244
      Ben Gamari authored
      5e1a2244
    • Ben Gamari's avatar
      testsuite: Eliminate fragility of ioprof · 3e343292
      Ben Gamari authored
      As noted in #10037, the `ioprof` test would change its stderr output
      (specifically the stacktrace produced by `error`) depending upon
      optimisation level. As the `error` backtrace is not the point of this
      test, we now ignore the `stderr` output.
      3e343292
    • Simon Peyton Jones's avatar
      Drop absent bindings in worker/wrapper · 34424b9d
      Simon Peyton Jones authored
      Consider this (from #19824)
         let t = ...big...
         in ...(f t x)...
      
      were `f` ignores its first argument.  With luck f's wrapper will inline
      thereby dropping `t`, but maybe not: the arguments to f all look boring.
      
      So we pre-empt the problem by replacing t's RHS with an absent filler
      during w/w.  Simple and effective.
      
      The main payload is the new `isAbsDmd` case in `tryWw`, but there are
      some other minor refactorings:
      
      * To implment this I had to refactor `mk_absent_let` to
        `mkAbsentFiller`, which can be called from `tryWW`.
      
      * wwExpr took both WwOpts and DynFlags which seems silly.  I combined
        them into one.
      
      * I renamed the historical mkInineRule to mkWrapperUnfolding
      34424b9d
    • Simon Peyton Jones's avatar
      Re-do rubbish literals · 52a524f7
      Simon Peyton Jones authored
      As #19882 pointed out, we were simply doing rubbish literals wrong.
      (I'll refrain from explaining the wrong-ness here -- see the ticket.)
      
      This patch fixes it by adding a Type (of kind RuntimeRep) as field of
      LitRubbish, rather than [PrimRep].
      
      The Note [Rubbish literals] in GHC.Types.Literal explains the details.
      52a524f7