Skip to content
Snippets Groups Projects
  1. Jul 31, 2023
  2. Jul 30, 2023
    • Julian Ospald's avatar
    • Simon Peyton Jones's avatar
      Make the occurrence analyser smarter about join points · d0369802
      Simon Peyton Jones authored and Simon Peyton Jones's avatar Simon Peyton Jones committed
      This MR addresses #22404.  There is a big Note
      
         Note [Occurrence analysis for join points]
      
      that explains it all.  Significant changes
      
      * New field occ_join_points in OccEnv
      
      * The NonRec case of occAnalBind splits into two cases:
        one for existing join points (which does the special magic for
        Note [Occurrence analysis for join points], and one for other
        bindings.
      
      * mkOneOcc adds in info from occ_join_points.
      
      * All "bring into scope" activity is centralised in the
        new function `addInScope`.
      
      * I made a local data type LocalOcc for use inside the occurrence analyser
        It is like OccInfo, but lacks IAmDead and IAmALoopBreaker, which in turn
        makes computationns over it simpler and more efficient.
      
      * I found quite a bit of allocation in GHC.Core.Rules.getRules
        so I optimised it a bit.
      
      More minor changes
      
      * I found I was using (Maybe Arity) a lot, so I defined a new data
        type JoinPointHood and used it everwhere.  This touches a lot of
        non-occ-anal files, but it makes everything more perspicuous.
      
      * Renamed data constructor WithUsageDetails to WUD, and
        WithTailUsageDetails to WTUD
      
      This also fixes #21128, on the way.
      
      --------- Compiler perf -----------
      I spent quite a time on performance tuning, so even though it
      does more than before, the occurrence analyser runs slightly faster
      on average.  Here are the compile-time allocation changes over 0.5%
      
            CoOpt_Read(normal) ghc/alloc    766,025,520    754,561,992  -1.5%
      CoOpt_Singletons(normal) ghc/alloc    759,436,840    762,925,512  +0.5%
           LargeRecord(normal) ghc/alloc  1,814,482,440  1,799,530,456  -0.8%
             PmSeriesT(normal) ghc/alloc     68,159,272     67,519,720  -0.9%
                T10858(normal) ghc/alloc    120,805,224    118,746,968  -1.7%
                T11374(normal) ghc/alloc    164,901,104    164,070,624  -0.5%
                T11545(normal) ghc/alloc     79,851,808     78,964,704  -1.1%
                T12150(optasm) ghc/alloc     73,903,664     71,237,544  -3.6% GOOD
                T12227(normal) ghc/alloc    333,663,200    331,625,864  -0.6%
                T12234(optasm) ghc/alloc     52,583,224     52,340,344  -0.5%
                T12425(optasm) ghc/alloc     81,943,216     81,566,720  -0.5%
                T13056(optasm) ghc/alloc    294,517,928    289,642,512  -1.7%
            T13253-spj(normal) ghc/alloc    118,271,264     59,859,040 -49.4% GOOD
                T15164(normal) ghc/alloc  1,102,630,352  1,091,841,296  -1.0%
                T15304(normal) ghc/alloc  1,196,084,000  1,166,733,000  -2.5%
                T15630(normal) ghc/alloc    148,729,632    147,261,064  -1.0%
                T15703(normal) ghc/alloc    379,366,664    377,600,008  -0.5%
                T16875(normal) ghc/alloc     32,907,120     32,670,976  -0.7%
                T17516(normal) ghc/alloc  1,658,001,888  1,627,863,848  -1.8%
                T17836(normal) ghc/alloc    395,329,400    393,080,248  -0.6%
                T18140(normal) ghc/alloc     71,968,824     73,243,040  +1.8%
                T18223(normal) ghc/alloc    456,852,568    453,059,088  -0.8%
                T18282(normal) ghc/alloc    129,105,576    131,397,064  +1.8%
                T18304(normal) ghc/alloc     71,311,712     70,722,720  -0.8%
               T18698a(normal) ghc/alloc    208,795,112    210,102,904  +0.6%
               T18698b(normal) ghc/alloc    230,320,736    232,697,976  +1.0%  BAD
                T19695(normal) ghc/alloc  1,483,648,128  1,504,702,976  +1.4%
                T20049(normal) ghc/alloc     85,612,024     85,114,376  -0.6%
               T21839c(normal) ghc/alloc    415,080,992    410,906,216  -1.0% GOOD
                 T4801(normal) ghc/alloc    247,590,920    250,726,272  +1.3%
                 T6048(optasm) ghc/alloc     95,699,416     95,080,680  -0.6%
                  T783(normal) ghc/alloc    335,323,384    332,988,120  -0.7%
                 T9233(normal) ghc/alloc    709,641,224    685,947,008  -3.3% GOOD
                 T9630(normal) ghc/alloc    965,635,712    948,356,120  -1.8%
                 T9675(optasm) ghc/alloc    444,604,152    428,987,216  -3.5% GOOD
                 T9961(normal) ghc/alloc    303,064,592    308,798,800  +1.9%  BAD
                 WWRec(normal) ghc/alloc    503,728,832    498,102,272  -1.1%
      
                     geo. mean                                          -1.0%
                     minimum                                           -49.4%
                     maximum                                            +1.9%
      
      In fact these figures seem to vary between platforms; generally worse
      on i386 for some reason.  The Windows numbers vary by 1% espec in
      benchmarks where the total allocation is low. But the geom mean stays
      solidly negative, which is good.  The "increase/decrease" list below
      covers all platforms.
      
      The big win on T13253-spj comes because it has a big nest of join
      points, each occurring twice in the next one.  The new occ-anal takes
      only one iteration of the simplifier to do the inlining; the old one
      took four.  Moreover, we get much smaller code with the new one:
      
        New: Result size of Tidy Core
          = {terms: 429, types: 84, coercions: 0, joins: 14/14}
      
        Old: Result size of Tidy Core
          = {terms: 2,437, types: 304, coercions: 0, joins: 10/10}
      
      --------- Runtime perf -----------
      No significant changes in nofib results, except a 1% reduction in
      compiler allocation.
      
      Metric Decrease:
          CoOpt_Read
          T13253-spj
          T9233
          T9630
          T9675
          T12150
          T21839c
          LargeRecord
          MultiComponentModulesRecomp
          T10421
          T13701
          T10421
          T13701
          T12425
      
      Metric Increase:
          T18140
          T9961
          T18282
          T18698a
          T18698b
          T19695
      d0369802
  3. Jul 28, 2023
    • Bodigrim's avatar
      Add since pragmas to GHC.IO.Handle.FD · ee93edfd
      Bodigrim authored and Marge Bot's avatar Marge Bot committed
      ee93edfd
    • Bodigrim's avatar
      Bump filepath submodule to 1.4.100.4 · e9a0fa3f
      Bodigrim authored and Marge Bot's avatar Marge Bot committed
      Resolves #23741
      
      Metric Decrease:
          MultiComponentModules
          MultiComponentModulesRecomp
          MultiLayerModules
          MultiLayerModulesRecomp
          T10421
          T12234
          T12425
          T13035
          T13701
          T13719
          T16875
          T18304
          T18698a
          T18698b
          T21839c
          T9198
          TcPlugin_RewritePerf
          hard_hole_fits
      
      Metric decrease on Windows can be probably attributed to https://github.com/haskell/filepath/pull/183
      e9a0fa3f
    • Andreas Klebinger's avatar
      Aarch64 NCG: Use encoded immediates for literals. · 40425c50
      Andreas Klebinger authored and Marge Bot's avatar Marge Bot committed
      Try to generate
      
          instr x2, <imm>
      
      instead of
      
          mov x1, lit
          instr x2, x1
      
      When possible. This get's rid if quite a few redundant
      mov instructions.
      
      I believe this causes a metric decrease for LargeRecords as
      we reduce register pressure.
      
      -------------------------
      Metric Decrease:
          LargeRecord
      -------------------------
      40425c50
    • Finley McIlwaine's avatar
      Include -haddock in DynFlags fingerprint · 0bfc8908
      Finley McIlwaine authored and Marge Bot's avatar Marge Bot committed
      The -haddock flag determines whether or not the resulting .hi files
      contain haddock documentation strings. If the existing .hi files do
      not contain haddock documentation strings and the user requests them,
      we should recompile.
      0bfc8908
    • Ben Gamari's avatar
      ghc-prim: Use C11 atomics · f8fa1d08
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Previously `ghc-prim`'s atomic wrappers used the legacy `__sync_*`
      family of C builtins. Here we refactor these to rather use the
      appropriate C11 atomic equivalents, allowing us to be more explicit
      about the expected ordering semantics.
      f8fa1d08
    • BinderDavid's avatar
      Improve documentation for Data.Fixed · 86ad1af9
      BinderDavid authored and Marge Bot's avatar Marge Bot committed
      86ad1af9
    • David's avatar
      Update Match Datatype · a5319358
      David authored and Marge Bot's avatar Marge Bot committed
      EquationInfo currently contains a list of the equation's patterns together with a CoreExpr that is to be evaluated after a successful match on this equation.
      All the match-functions only operate on the first pattern of an equation - after successfully matching it, match is called recursively on the tail of the pattern list.
      We can express this more clearly and make the code a little more elegant by updating the datatype of EquationInfo as follows:
      
      data EquationInfo
          = EqnMatch { eqn_pat = Pat GhcTc, eqn_rest = EquationInfo }
          | EqnDone { eqn_rhs = MatchResult CoreExpr }
      
      An EquationInfo now explicitly exposes its first pattern which most functions operate on, and exposes the equation that remains after processing the first pattern. An EqnDone signifies an empty equation where the CoreExpr can now be evaluated.
      a5319358
  4. Jul 27, 2023
  5. Jul 26, 2023
    • Arnaud Spiwack's avatar
      Fix user-facing label in MR template · af6fdf42
      Arnaud Spiwack authored and Marge Bot's avatar Marge Bot committed
      af6fdf42
    • Bartłomiej Cieślar's avatar
      This MR is an implementation of the proposal #516. · 503fd647
      Bartłomiej Cieślar authored and Marge Bot's avatar Marge Bot committed
      It adds a warning -Wincomplete-record-selectors for usages of a record
      field access function (either a record selector or getField @"rec"),
      while trying to silence the warning whenever it can be sure that a constructor
      without the record field would not be invoked (which would otherwise cause
      the program to fail). For example:
      
          data T = T1 | T2 {x :: Bool}
      
          f a = x a -- this would throw an error
      
          g T1 = True
          g a = x a -- this would not throw an error
      
          h :: HasField "x" r Bool => r -> Bool
          h = getField @"x"
      
          j :: T -> Bool
          j = h -- this would throw an error because of the `HasField`
                -- constraint being solved
      
      See the tests DsIncompleteRecSel* and TcIncompleteRecSel for more examples of the warning.
      See Note [Detecting incomplete record selectors] in GHC.HsToCore.Expr for implementation details
      503fd647
    • Naïm Favier's avatar
      docs: Fix typo · fac9e84e
      Naïm Favier authored and Marge Bot's avatar Marge Bot committed
      fac9e84e
    • Rodrigo Mesquita's avatar
      configure: Default missing options to False when preparing ghc-toolchain Targets · 20db7e26
      Rodrigo Mesquita authored and Marge Bot's avatar Marge Bot committed
      This commit fixes building ghc with 9.2 as the boostrap compiler.
      
      The ghc-toolchain patch assumed all _STAGE0 options were available, and
      forgot to account for this missing information in 9.2.
      
      Ghc 9.2 does not have in settings whether ar supports -l, hence can't
      report it with --info (unliked 9.4 upwards).
      
      The fix is to default the missing information (we default "ar supports
      -l" and other missing options to False)
      20db7e26
    • Krzysztof Gogolewski's avatar
      llvm: Restore accidentally deleted code in 0fc5cb97 · 79463036
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      Fixes #23711
      79463036
    • Gavin Zhao's avatar
      compiler: make -ddump-asm work with wasm backend NCG · 9393df83
      Gavin Zhao authored and Marge Bot's avatar Marge Bot committed
      
      Fixes #23503.
      
      Now the `-ddump-asm` flag is respected in the wasm backend
      NCG, so developers can directly view the generated ASM instead of
      needing to pass `-S` or `-keep-tmp-files` and manually find & open
      the assembly file.
      
      Ideally, we should be able to output the assembly files in smaller
      chunks like in other NCG backends. This would also make dumping assembly
      stats easier. However, this would require a large refactoring, so for
      short-term debugging purposes I think the current approach works fine.
      
      Signed-off-by: default avatarGavin Zhao <git@gzgz.dev>
      9393df83
    • Alan Zimmerman's avatar
      EPA: Simplify GHC/Parser.y comb4/comb5 · 355e1792
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      Use the HasLoc instance from Ast.hs to allow comb4/comb5 to work with
      anything with a SrcSpan
      
      Also get rid of some more now unnecessary reLoc calls.
      355e1792
  6. Jul 25, 2023
  7. Jul 24, 2023
    • Matthew Pickering's avatar
      compiler: Remove unused `containers.h` include · 02e6a6ce
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      Fixes #23712
      02e6a6ce
    • Matthew Craven's avatar
      Kill off gen_bytearray_addr_access_ops.py · 32cae784
      Matthew Craven authored and Marge Bot's avatar Marge Bot committed
      The relevant primop descriptions are now
      generated directly by genprimopcode.
      
      This makes progress toward fixing #23490, but it is not
      a complete fix since there is more than one way in which
      cabal-reinstall (hadrian/build build-cabal) is broken.
      32cae784
    • Rodrigo Mesquita's avatar
      Ship ghc-toolchain in the bindist · 38e795ff
      Rodrigo Mesquita authored and Matthew Pickering's avatar Matthew Pickering committed
      Add the ghc-toolchain binary to the binary distribution we ship to
      users, and teach the bindist configure to use the existing ghc-toolchain.
      38e795ff
    • Rodrigo Mesquita's avatar
      Split ghc-toolchain executable to new packge · 61eea240
      Rodrigo Mesquita authored and Matthew Pickering's avatar Matthew Pickering committed
      In light of #23690, we split the ghc-toolchain executable out of the
      library package to be able to ship it in the bindist using Hadrian.
      
      Ideally, we eventually revert this commit.
      61eea240
    • Rodrigo Mesquita's avatar
      Add flag to enable/disable ghc-toolchain based configurations · a732b6d3
      Rodrigo Mesquita authored and Matthew Pickering's avatar Matthew Pickering committed
      This flag is disabled by default, and we'll use the
      configure-generated-toolchains by default until we remove the toolchain
      configuration logic from configure.
      a732b6d3
    • Rodrigo Mesquita's avatar
      ghc-toolchain: Toolchain Selection · 31dcd26c
      Rodrigo Mesquita authored and Matthew Pickering's avatar Matthew Pickering committed
      This commit integrates ghc-toolchain, the brand new way of configuring
      toolchains for GHC, with the Hadrian build system, with configure, and
      extends and improves the first iteration of ghc-toolchain.
      
      The general overview is
      
      * We introduce a program invoked `ghc-toolchain --triple=...` which, when run,
        produces a file with a `Target`. A `GHC.Toolchain.Target.Target`
        describes the properties of a target and the toolchain (executables
        and configured flags) to produce code for that target
      
      * Hadrian was modified to read Target files, and will both
        * Invoke the toolchain configured in the Target file as needed
        * Produce a `settings` file for GHC based on the Target file for that stage
      
      * `./configure` will invoke ghc-toolchain to generate target files, but
        it will also generate target files based on the flags configure itself
        configured (through `.in` files that are substituted)
      
        * By default, the Targets generated by configure are still (for now) the ones used by Hadrian
      
        * But we additionally validate the Target files generated by
          ghc-toolchain against the ones generated by configure, to get a head
          start on catching configuration bugs before we transition
          completely.
      
        * When we make that transition, we will want to drop a lot of the
          toolchain configuration logic from configure, but keep it otherwise.
      
      * For each compiler stage we should have 1 target file (up to a stage compiler we can't run in our machine)
        * We just have a HOST target file, which we use as the target for stage0
        * And a TARGET target file, which we use for stage1 (and later stages, if not cross compiling)
        * Note there is no BUILD target file, because we only support cross compilation where BUILD=HOST
        * (for more details on cross-compilation see discussion on !9263)
      
      See also
      * Note [How we configure the bundled windows toolchain]
      * Note [ghc-toolchain consistency checking]
      * Note [ghc-toolchain overview]
      
      Ticket: #19877
      MR: !9263
      31dcd26c
    • Ben Gamari's avatar
      ghc-toolchain: Initial commit · 83cbc672
      Ben Gamari authored and Matthew Pickering's avatar Matthew Pickering committed
      83cbc672
  8. Jul 23, 2023
    • sheaf's avatar
      Add test for #22424 · 73b5c7ce
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This is a simple Template Haskell test in which we refer to
      record selectors by their exact Names, in two different ways.
      
      Fixes #22424
      73b5c7ce
    • Vladislav Zavialov's avatar
      Visible forall in types of terms: Part 1 (#22326) · 33b6850a
      Vladislav Zavialov authored and Marge Bot's avatar Marge Bot committed
      This patch implements part 1 of GHC Proposal #281,
      introducing explicit `type` patterns and `type` arguments.
      
      Summary of the changes:
      
      1. New extension flag:
           RequiredTypeArguments
      
      2. New user-facing syntax:
           `type p` patterns    (represented by EmbTyPat)
           `type e` expressions (represented by HsEmbTy)
      
      3. Functions with required type arguments (visible forall)
         can now be defined and applied:
            idv :: forall a -> a -> a    -- signature   (relevant change: checkVdqOK in GHC/Tc/Validity.hs)
            idv (type a) (x :: a) = x    -- definition  (relevant change: tcPats in GHC/Tc/Gen/Pat.hs)
            x = idv (type Int) 42        -- usage       (relevant change: tcInstFun in GHC/Tc/Gen/App.hs)
      
      4. template-haskell support:
            TH.TypeE corresponds to HsEmbTy
            TH.TypeP corresponds to EmbTyPat
      
      5. Test cases and a new User's Guide section
      
      Changes *not* included here are the t2t (term-to-type) transformation
      and term variable capture; those belong to part 2.
      33b6850a
  9. Jul 22, 2023
    • Krzysztof Gogolewski's avatar
      Misc cleanup · a7349217
      Krzysztof Gogolewski authored and Marge Bot's avatar Marge Bot committed
      - Remove unused RDR names
      - Fix typos in comments
      - Deriving: simplify boxConTbl and remove unused litConTbl
      - chmod -x GHC/Exts.hs, this seems accidental
      a7349217
    • sheaf's avatar
      Stop marking plugin tests as fragile on Windows · cb9c93d7
      sheaf authored and Marge Bot's avatar Marge Bot committed
      Now that b2bb3e62 has landed we are in a better situation with
      regards to plugins on Windows, allowing us to unmark many plugin tests
      as fragile.
      
      Fixes #16405
      cb9c93d7
    • sheaf's avatar
      Mark plugins-external as broken on Windows · a72015d6
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This test is broken on Windows, so we explicitly mark it as such now
      that we stop skipping plugin tests on Windows.
      a72015d6
    • sheaf's avatar
      RTS: declare setKeepCAFs symbol · 42b05e9b
      sheaf authored and Marge Bot's avatar Marge Bot committed
      Commit 08ba8720 failed to declare the dependency of keepCAFsForGHCi on
      the symbol setKeepCAFs in the RTS, which led to undefined symbol errors
      on Windows, as exhibited by the testcase frontend001.
      
      Thanks to Moritz Angermann and Ryan Scott for the diagnosis and fix.
      
      Fixes #22961
      42b05e9b
    • Matthew Pickering's avatar
      ci: Mention ~full-ci label in MR template · b91bbc2b
      Matthew Pickering authored and Marge Bot's avatar Marge Bot committed
      We mention that if you need a full validation pipeline then you can
      apply the ~full-ci label to your MR in order to test against the full
      validation pipeline (like we do for marge).
      b91bbc2b
Loading