Skip to content
Snippets Groups Projects
This project is mirrored from https://gitlab.haskell.org/ghc/ghc.git. Pull mirroring failed .
Repository mirroring has been paused due to too many failed attempts. It can be resumed by a project maintainer or owner.
Last successful update .
  1. Aug 14, 2023
  2. Aug 10, 2023
  3. Aug 09, 2023
    • Matthew Craven's avatar
      Bump bytestring submodule to 0.11.5, again · bf885d7a
      Matthew Craven authored and Marge Bot's avatar Marge Bot committed
      Fixes #23789.
      
      The bytestring commit used here is unreleased;
      a release can be made when necessary.
      bf885d7a
    • Sebastian Graf's avatar
      CorePrep: Eta expand arguments (#23083) · 00d31188
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      Previously, we'd only eta expand let bindings and lambdas,
      now we'll also eta expand arguments such as in T23083:
      ```hs
      g f h = f (h `seq` (h $))
      ```
      Unless `-fpedantic-bottoms` is set, we'll now transform to
      ```hs
      g f h = f (\eta -> h eta)
      ```
      in CorePrep.
      
      See the new `Note [Eta expansion of arguments in CorePrep]` for the details.
      
      We only do this optimisation with -O2 because we saw 2-3% ghc/alloc regressions
      in T4801 and T5321FD.
      
      Fixes #23083.
      00d31188
    • Sebastian Graf's avatar
      CorePrep: Eliminate EmptyCase and unsafeEqualityProof in CoreToStg instead · 59202c80
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      We eliminate EmptyCase by way of `coreToStg (Case e _ _ []) = coreToStg e` now.
      The main reason is that it plays far better in conjunction with eta expansion
      (as we aim to do for arguments in CorePrep, #23083), because we can discard
      any arguments, `(case e of {}) eta == case e of {}`, whereas in `(e |> co) eta`
      it's impossible to discard the argument.
      
      We do also give the same treatment to unsafeCoerce proofs and treat them as
      trivial iff their RHS is trivial.
      
      It is also both much simpler to describe than the previous mechanism of emitting
      an unsafe coercion and simpler to implement, removing quite a bit of commentary
      and `CorePrepProv`.
      
      In the ghc/alloc perf test `LargeRecord`, we introduce an additional Simplifier
      iteration due to #17910. E.g., FloatOut produces a binding
      ```
      lvl_s6uK [Occ=Once1] :: GHC.Types.Int
      [LclId]
      lvl_s6uK = GHC.Types.I# 2#
      
      lvl_s6uL [Occ=Once1] :: GHC.Types.Any
      [LclId]
      lvl_s6uL
        = case Unsafe.Coerce.unsafeEqualityProof ... of
          { Unsafe.Coerce.UnsafeRefl v2_i6tr -> lvl_s6uK `cast` (... v2_i6tr ...)
          }
      ```
      That occurs once and hence is pre-inlined unconditionally in the next Simplifier
      pass. It's non-trivial to find a way around that, but not really harmful
      otherwise. Hence we accept a 1.2% increase on some architectures.
      
      Metric Increase:
          LargeRecord
      59202c80
    • Sebastian Graf's avatar
      Deactivate -fcatch-nonexhaustive-cases in ghc-bignum (#23345) · 357f2738
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      357f2738
    • Sebastian Graf's avatar
      ANFise string literal arguments (#23270) · 7e0c8b3b
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      This instates the invariant that a trivial CoreExpr translates to an atomic
      StgExpr. Nice.
      
      Annoyingly, in -O0 we sometimes generate
      ```
      foo = case "blah"# of sat { __DEFAULT -> unpackCString# sat }
      ```
      which makes it a bit harder to spot that we can emit a standard
      `stg_unpack_cstring` thunk.
      
      Fixes #23270.
      7e0c8b3b
    • Sebastian Graf's avatar
      Kill SetLevel.notWorthFloating.is_triv (#23270) · b0f4752e
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      We have had it since b84ba676, when it operated on annotated expressions.
      Nowadays it operates on vanilla `CoreExpr` though, so we should just call
      `exprIsTrivial`; thus handling empty cases and string literals correctly.
      b0f4752e
    • Sebastian Graf's avatar
      Clarify floating of unsafeEqualityProofs (#23754) · 4a6b7c87
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      4a6b7c87
    • Sebastian Graf's avatar
      Inlining literals into boring contexts is OK · f06e87e4
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      f06e87e4
    • Sebastian Graf's avatar
      Disable tests RepPolyWrappedVar2 and RepPolyUnsafeCoerce1 in JS backend · d8d993f1
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      ... because those coerce between incompatible/unknown PrimReps.
      d8d993f1
    • Sebastian Graf's avatar
      Core.Ppr: Omit case binder for empty case alternatives · 8c73505e
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      A minor improvement to pretty-printing
      8c73505e
    • Sebastian Graf's avatar
      Simplify: Simplification of arguments in a single function · d004a36d
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      The Simplifier had a function `simplArg` that wasn't called in `rebuildCall`,
      which seems to be the main way to simplify args. Hence I consolidated the code
      path to call `simplArg`, too, renaming to `simplLazyArg`.
      d004a36d
    • Sebastian Graf's avatar
      exprIsTrivial: Factor out shared implementation · ce8aa54c
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      The duplication between `exprIsTrivial` and `getIdFromTrivialExpr_maybe` has
      been bugging me for a long time.
      
      This patch introduces an inlinable worker function `trivial_expr_fold` acting
      as the single, shared decision procedure of triviality. It "returns" a
      Church-encoded `Maybe (Maybe Id)`, so when it is inlined, it fuses to similar
      code as before.
      (Better code, even, in the case of `getIdFromTrivialExpr` which presently
      allocates a `Just` constructor that cancels away after this patch.)
      ce8aa54c
    • Sebastian Graf's avatar
      More explicit strictness in GHC.Real · 2274abc8
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      2274abc8
    • Sebastian Graf's avatar
      Cleanup a TODO introduced in 1f94e0f7 · 1a98d673
      Sebastian Graf authored and Marge Bot's avatar Marge Bot committed
      The change must have slipped through review of !4412
      1a98d673
    • Alan Zimmerman's avatar
      EPA: Remove Location from WarningTxt source · 6eab07b2
      Alan Zimmerman authored and Marge Bot's avatar Marge Bot committed
      This is not needed.
      6eab07b2
    • Fraser Tweedale's avatar
      numberToRangedRational: fix edge cases for exp ≈ (maxBound :: Int) · 4bc7b1e5
      Fraser Tweedale authored and Marge Bot's avatar Marge Bot committed
      Currently a negative exponent less than `minBound :: Int` results in
      Infinity, which is very surprising and obviously wrong.
      
      ```
      λ> read "1e-9223372036854775808" :: Double
      0.0
      λ> read "1e-9223372036854775809" :: Double
      Infinity
      ```
      
      There is a further edge case where the exponent can overflow when
      increased by the number of tens places in the integer part, or
      underflow when decreased by the number of leading zeros in the
      fractional part if the integer part is zero:
      
      ```
      λ> read "10e9223372036854775807" :: Double
      0.0
      λ> read "0.01e-9223372036854775808" :: Double
      Infinity
      ```
      
      To resolve both of these issues, perform all arithmetic and
      comparisons involving the exponent in type `Integer`.  This approach
      also eliminates the need to explicitly check the exponent against
      `maxBound :: Int` and `minBound :: Int`, because the allowed range
      of the exponent (i.e. the result of `floatRange` for the target
      floating point type) is certainly within those bounds.
      
      This change implements CLC proposal 192:
      https://github.com/haskell/core-libraries-committee/issues/192
      4bc7b1e5
    • sheaf's avatar
      Compute all emitted diagnostic codes · 0ef1d8ae
      sheaf authored and Marge Bot's avatar Marge Bot committed
      This commit introduces in GHC.Types.Error.Codes the function
      
        constructorCodes :: forall diag. (...) => Map DiagnosticCode String
      
      which computes a collection of all the diagnostic codes that correspond
      to a particular type. In particular, we can compute the collection of
      all diagnostic codes emitted by GHC using the invocation
      
        constructorCodes @GhcMessage
      
      We then make use of this functionality in the new "codes" test which
      checks consistency and coverage of GHC diagnostic codes.
      It performs three checks:
      
        - check 1: all non-outdated GhcDiagnosticCode equations
          are statically used.
        - check 2: all outdated GhcDiagnosticCode equations
          are statically unused.
        - check 3: all statically used diagnostic codes are covered by
          the testsuite (modulo accepted exceptions).
      0ef1d8ae
  4. Aug 08, 2023
    • Ryan Scott's avatar
      tcExpr: Push expected types for untyped TH splices inwards · 3b373838
      Ryan Scott authored and Marge Bot's avatar Marge Bot committed
      In !10911, I deleted a `tcExpr` case for `HsUntypedSplice` in favor of a much
      simpler case that simply delegates to `tcApp`. Although this passed the test
      suite at the time, this was actually an error, as the previous `tcExpr` case
      was critically pushing the expected type inwards. This actually matters for
      programs like the one in #23796, which GHC would not accept with type inference
      alone—we need full-blown type _checking_ to accept these.
      
      I have added back the previous `tcExpr` case for `HsUntypedSplice` and now
      explain why we have two different `HsUntypedSplice` cases (one in `tcExpr` and
      another in `splitHsApps`) in `Note [Looking through Template Haskell splices in
      splitHsApps]` in `GHC.Tc.Gen.Head`.
      
      Fixes #23796.
      3b373838
    • Ben Gamari's avatar
      configure: Derive library version from ghc-prim.cabal.in · 01961be3
      Ben Gamari authored and Marge Bot's avatar Marge Bot committed
      Since ghc-prim.cabal is now generated by Hadrian, we cannot depend upon
      it.
      
      Closes #23726.
      01961be3
  5. Aug 07, 2023
Loading