[Git][ghc/ghc][wip/romes/async-rpc] fixup! ghc-boot-th: avoid orphan NFData instances
by Andrea Vezzosi (@trac-Saizan) 25 Nov '26
by Andrea Vezzosi (@trac-Saizan) 25 Nov '26
25 Nov '26
Andrea Vezzosi pushed to branch wip/romes/async-rpc at Glasgow Haskell Compiler / GHC
Commits:
75c2e58c by Andrea Vezzosi at 2026-11-25T10:09:40+01:00
fixup! ghc-boot-th: avoid orphan NFData instances
- - - - -
1 changed file:
- compiler/GHC/Tc/Gen/Splice.hs
Changes:
=====================================
compiler/GHC/Tc/Gen/Splice.hs
=====================================
@@ -1146,12 +1146,14 @@ convertAnnotationWrapper fhv = do
runQinTcM :: TH.Q a -> TcM a
runQinTcM (TH.Q act) = withRunInIO $ \runInIO -> act (metaHandlersTcM runInIO)
+#if defined(HAVE_INTERNAL_INTERPRETER)
-- | Like 'runQinTcM' but forcing methods' arguments, to trigger exceptions
-- originating from the splice.
--
-- See Note [Exceptions in TH]
runQinTcM' :: TH.Q a -> TcM a
runQinTcM' (TH.Q act) = withRunInIO $ \runInIO -> act (TH.forceMetaHandlersArgs $ metaHandlersTcM runInIO)
+#endif
runRemoteModFinalizers :: ThModFinalizers -> TcM ()
runRemoteModFinalizers (ThModFinalizers finRefs) = do
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/75c2e58cfd1e73f81fe479e4e1670ed…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/75c2e58cfd1e73f81fe479e4e1670ed…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
25 Nov '26
Simon Peyton Jones pushed to branch wip/case-bndr-unf at Glasgow Haskell Compiler / GHC
Commits:
1045f6c7 by Simon Peyton Jones at 2026-11-25T09:12:37+00:00
Add splitThunkCpr
This commit adds GHC.Core.Opt.WorkWrap.splitThunkCpr, which adds a form
of "thunk splitting" for strict bindings that have CPR information.
See Note [Thunk splitting] in WorkWrap.hs for the details.
It catches a previously-unrecognised optimisation opportunity
(see #28158) but it only helps in fairly obscure cases, so
I don't expect a big impact in practice.
As usually I did lots of refactoring along the way.
LLM disclosure: lots of interaction with Claude, but I wrote all the
code and comments.
- - - - -
9 changed files:
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Types/Cpr.hs
- compiler/GHC/Utils/Monad.hs
- + testsuite/tests/simplCore/should_compile/T28158.hs
- + testsuite/tests/simplCore/should_compile/T28158.stderr
- testsuite/tests/simplCore/should_compile/all.T
Changes:
=====================================
compiler/GHC/Core/Opt/CprAnal.hs
=====================================
@@ -173,6 +173,25 @@ So currently we have
1. Strictness
2. CPR
3. worker/wrapper (for strictness and CPR)
+
+Wrinkles
+
+(CPR1) We have a flag `-fcpr-anal`, which sets `Opt_CprAnal`, enabled in -O1 and
+ -O1. Strangely, it does /not/ switch off CPR analysis! Rather, it just
+ switches off the worker/wrapper exploitation of CPR analysis, in `mkWWcpr_entry`.
+ The analysis itself runes whenever `-fstrictness` is on.
+
+ This is peculiar and, I suspect accidental. It would make more sense to switch
+ off the analysis itself with `-fno-cpr-anal`.
+
+ It goes back to at least
+ commit ecb1752ffa12dfa71053f640e6cce64d15e47e8f
+ Author: Christiaan Baaij <christiaan.baaij(a)gmail.com>
+ Date: Wed Aug 5 14:22:14 2015 +0200
+
+ Make -fcpr-off a dynamic flag
+
+ This note is just a breadcrumb to inform the next person who trips over this.
-}
--
@@ -343,7 +362,7 @@ cprTransform env id args
-- Any local binding, except for data structure bindings
-- See Note [Efficient Top sigs in SigEnv]
| Just sig <- lookupSigEnv env id
- = applyCprTy (getCprSig sig) (length args)
+ = applyCprTy (cprSigType sig) (length args)
-- See Note [CPR for data structures]
| Just rhs <- cprDataStructureUnfolding_maybe id
= fst $ cprAnal env rhs
@@ -362,7 +381,7 @@ cprTransform env id args
= cprTransformDataConWork env con args
-- Imported function
| otherwise
- = applyCprTy (getCprSig (idCprSig id)) (length args)
+ = applyCprTy (cprSigType (idCprSig id)) (length args)
-- | Precise, hand-written CPR transformers for select Ids
cprTransformBespoke :: Id -> [(CprType, CoreArg)] -> Maybe CprType
@@ -870,27 +889,42 @@ Does f have the CPR property? Well, no.
However, if the strictness analyser has figured out (in a previous
iteration) that it's strict, then we DON'T need to forget the CPR info.
Instead we can retain the CPR info and do the thunk-splitting transform
-(see WorkWrap.splitThunk).
+(see Note [Thunk splitting] esp (B) CPR-led thunk splitting).
This made a big difference to PrelBase.modInt, which had something like
modInt = \ x -> let r = ... -> I# v in
...body strict in r...
-r's RHS isn't a value yet; but modInt returns r in various branches, so
-if r doesn't have the CPR property then neither does modInt
+r's RHS isn't a value yet; but `modInt` returns `r` in various branches, so
+if `r` doesn't have the CPR property then neither does `modInt`
+
Another case I found in practice (in Complex.magnitude), looks like this:
- let k = if ... then I# a else I# b
- in ... body strict in k ....
+ let k* = if ... then I# a else I# b
+ in ... body strict in k ....
(For this example, it doesn't matter whether k is returned as part of
the overall result; but it does matter that k's RHS has the CPR property.)
+
Left to itself, the simplifier will make a join point thus:
- let $j k = ...body strict in k...
- if ... then $j (I# a) else $j (I# b)
+ let $j k = ...body strict in k...
+ if ... then $j (I# a) else $j (I# b)
+
With thunk-splitting, we get instead
- let $j x = let k = I#x in ...body strict in k...
- in if ... then $j a else $j b
+ let k* = case (if ... then I# a else I# b) of I# z -> I# z
+ in ... body strict in k ....
+Now the simplifier should pull out the `case` to give
+ case (if ... then I# a else I# b) of I# z ->
+ let k = I# z in ... body strict in k ...
+Now case-of-if will give
+ let $j z = let k = I# z in ...body strict in k... in
+ if ... then $j a else $j b
This is much better; there's a good chance the I# won't get allocated.
+TL'DR: During CPR analysis we want to give `k` the CPR property in `body`.
+
+What if the type involved has more than one constructor? E.g.
+ let k* = if ... then Just a else Just b
+ in ... body strict in k ....
+That is good too: see (TS5) in Note [Thunk splitting]
-But what about botCpr? Consider
+Finally, what about botCpr? Consider
lvl = error "boom"
fac -1 = lvl
fac 0 = 1
=====================================
compiler/GHC/Core/Opt/Simplify/Iteration.hs
=====================================
@@ -51,7 +51,6 @@ import GHC.Types.Literal ( litIsLifted ) --, mkLitInt ) -- temporarily comment
import GHC.Types.SourceText
import GHC.Types.Id
import GHC.Types.Id.Info
-import GHC.Types.Cpr( isTopCprSig )
import GHC.Types.InlinePragma
import GHC.Types.Name ( mkSystemVarName, isExternalName, getOccFS )
import GHC.Types.Demand
@@ -1830,7 +1829,7 @@ simplNonRecE :: HasDebugCallStack
simplNonRecE env from_what bndr (rhs, rhs_se) body cont
| assertPpr (isId bndr && not (isJoinId bndr)) (ppr bndr) True
- , useStrictBind env from_what bndr
+ , useStrictBind env from_what bndr rhs
= -- Evaluate RHS strictly
simplExprF (rhs_se `setInScopeFromE` env) rhs
(StrictBind { sc_bndr = bndr, sc_body = body, sc_from = from_what
@@ -1865,11 +1864,10 @@ simplRecE env pairs body cont
; return (floats1 `addFloats` floats2, expr') }
-useStrictBind :: SimplEnv -> FromWhat -> InId -> Bool
+useStrictBind :: SimplEnv -> FromWhat -> InId -> InExpr -> Bool
-- Can we use a StrictBind continuation for this let-binding?
--- If so, return a binder that is suitable to become a lambda binder,
--- i.e. one satisfying `lamBndrInfoOK`; see (SB3) in Note [StrictBind]
-useStrictBind env from_what bndr
+-- See (SB3) in Note [StrictBind]
+useStrictBind env from_what bndr rhs
-- If we are coming from a beta-reduction (FromBeta) we must
-- establish the let-can-float invariant, so we must go via StrictBind
-- If not, the invariant holds already, and it's optional.
@@ -1880,6 +1878,10 @@ useStrictBind env from_what bndr
| not (isStrUsedDmd dmd_info)
= False
+ -- Not if the RHS is ok-for-spec; no benefit
+ | exprOkForSpeculation rhs
+ = False
+
-- Not if case-of-case is off
-- See (SB1) in Note [StrictBind]
| not (seCaseCase env)
@@ -1894,8 +1896,6 @@ useStrictBind env from_what bndr
| isStableUnfolding (unfoldingInfo info)
|| not (isEmptyRuleInfo (ruleInfo info))
|| not (isAlwaysActive (inlinePragmaActivation (inlinePragInfo info)))
- || not (isNopSig (dmdSigInfo info))
- || not (isTopCprSig (cprSigInfo info))
= False
| otherwise
@@ -4243,9 +4243,8 @@ mkDupableAlt _env case_bndr jfloats (Alt con alt_bndrs alt_rhs_in)
, alt') }
-- See Note [Duplicated env]
-{-
-Note [Do not add unfoldings to join points at birth]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+{- Note [Do not add unfoldings to join points at birth]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider this (#15360)
case (case (case (case ...))) of
@@ -4316,7 +4315,7 @@ The simplifier will find
(Var v) with continuation
Select (pn -> rn) (
Select [I# a -> I# a] (
- StrictBind body Stop
+ StrictBind body Stop))
So we'll call mkDupableCont on
Select [I# a -> I# a] (StrictBind body Stop)
@@ -4455,7 +4454,7 @@ hack and bit us in multiple small and not-so-small ways
Consider this
case (case .. ) of c {
- I# c# -> ....c....
+ I# c# -> ....c.... }
If we make a join point with c but not c# we get
$j = \c -> ....c....
@@ -4655,30 +4654,43 @@ We simplify `rhs` with a StrictBind continuation that continues with
invariants] in GHC.Core. But a let-binder `x` usually has IdInfo that a
lambda binder may not have (an unfolding, arity, a demand signature...).
- So `useStrictBind_maybe` zaps that info, keeping only the occurrence info
- and the demand info. If it happens to stay as a let-binding arity info will
- be re-derived, so nothing is lost.
+ So when we duplicate StrictBind, in `mkDupableContWithDmds`, we use
+ `mkLamBndrFromLetBndr` to zap that info, keeping only the occurrence
+ info and the demand info.
- The exceptions are RULES, a stable unfolding, and a non-default inlining
- activation: these cannot be re-derived, and we have nowhere convenient to
- put them if `x` becomes a lambda binder. For example:
+ However, if the let-binder has
+ * RULES
+ * a stable unfolding
+ * a non-default inlining activation
+ we'd permanently lose these things if we lambda-bind it. For example:
let {-# NOINLINE x #-}
x! = case y of { ... }
in blah
- If we make a join point j x = blah, we have nowhere convenient
- to put that NOINLINE. Ditto INLINE or RULES. So in these cases we
- simply don't use StrictBind. It's very unusual, so no harm done.
- But it does happen; one example is this, in the Applicative (ST s)
- instance in GHC.Internal.Control.Monad.St.Lazy.Imp
+ If we make a join point j x = blah, we have nowhere convenient to put that
+ NOINLINE. Ditto INLINE or RULES. It's unusual. But it happens; one example
+ is the Applicative (ST s) instance in GHC.Internal.Control.Monad.St.Lazy.Imp
{-# NOINLINE res1 #-}
!res1 = unST fm s
- TL;DR: the sc_bndr::Id field in StrictBind always satisfies `lamBndrInfoOK`.
- This means that in the above example { x! = case y of ... } we won't
- float the `case y` out. And perhaps that's fine because of the NOINLNE.
- We could imagine instead imposing these conditions only when we /duplicate/
- the StrictBind, rather than when we /create/ it, but that would require a
- bigger refactor.
+ So in these cases we simply don't use StrictBind -- see `useStrictBind`. We
+ could imagine instead imposing these conditions only when we /duplicate/ the
+ StrictBind, rather than when we /create/ it, but that would require a bigger
+ refactor.
+
+ What if a thunk has a strictness signature, or CPR information? We
+ could make `useStrictBind` say False in these cases too, but that turns
+ out to be a net loss: keeping a thunk is worse than losing the strictness
+ information. Example, where f1,f2 are both strict:
+ let f* {- Str=<S> -} = case x of { True -> f1; False -> f2 }
+ in body
+ Keeping it as-is would use CBV for calls of `f` in `body`. But
+ allowing StrictBind would give us
+ join j f* = body
+ in case x of { True -> j f1; False -> j f2 }
+ which avoids the thunk. It's a trade-off.
+
+ For CPR info, see Note [Thunk splitting] in GHC.Core.Opt.WorkWrap,
+ especially (B) CPR-led thunk splitting.
Note [Join point abstraction] Historical note
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
=====================================
compiler/GHC/Core/Opt/WorkWrap.hs
=====================================
@@ -598,13 +598,19 @@ tryWW ww_opts is_rec fn_id rhs
= splitFun ww_opts new_fn_id rhs
-- See Note [Thunk splitting]
- | isNonRec is_rec, is_thunk
- = splitThunk ww_opts is_rec new_fn_id rhs
+ | isNonRec is_rec -- See (TS4)
+ , is_thunk -- All join points go via splitFun
+ = do { -- Try strictness then CPR; see (TS5)
+ rhs' <- splitThunkStr ww_opts new_fn_id rhs `orElseM`
+ splitThunkCpr ww_opts new_fn_id rhs `orElseM`
+ return rhs
+ ; return [ (new_fn_id, rhs') ] }
| otherwise
= return [ (new_fn_id, rhs) ]
where
+ is_join = isJoinId fn_id
fn_info = idInfo fn_id
(wrap_dmds, _) = splitDmdSig (dmdSigInfo fn_info)
new_fn_id = zap_join_cpr $ zap_usage fn_id
@@ -613,14 +619,13 @@ tryWW ww_opts is_rec fn_id rhs
-- See Note [Zapping DmdEnv after Demand Analyzer] and
-- See Note [Zapping Used Once info in WorkWrap]
- zap_join_cpr id
- | isJoinId id = id `setIdCprSig` topCprSig
- | otherwise = id
+ zap_join_cpr id | is_join = id `setIdCprSig` topCprSig
+ | otherwise = id
-- See Note [Don't w/w join points for CPR]
- is_fun = notNull wrap_dmds || isJoinId fn_id
- is_thunk = not is_fun && not (exprIsHNF rhs) && not (isJoinId fn_id)
- && not (isUnliftedType (idType fn_id))
+ is_fun = notNull wrap_dmds || is_join
+ is_thunk = not (exprIsHNF rhs)
+ && not (isUnliftedType (idType fn_id))
{-
Note [Zapping DmdEnv after Demand Analyzer]
@@ -806,7 +811,7 @@ splitFun ww_opts fn_id rhs
(wrap_dmds, div) = splitDmdSig (dmdSigInfo fn_info)
- cpr_ty = getCprSig (cprSigInfo fn_info)
+ cpr_ty = cprSigType (cprSigInfo fn_info)
-- Arity of the CPR sig should match idArity when it's not a join point.
-- See Note [Arity trimming for CPR signatures] in GHC.Core.Opt.CprAnal
cpr = assertPpr (isJoinId fn_id || cpr_ty == topCprType || ct_arty cpr_ty == arityInfo fn_info)
@@ -957,114 +962,177 @@ the form [Demand=<L,1*(C(1,...(C(1,U))))>]
Note [Thunk splitting]
~~~~~~~~~~~~~~~~~~~~~~
-Suppose x is used strictly; never mind whether it has the CPR
-property. I'll use a '*' to mean "x* is demanded strictly".
-
- let
- x* = x-rhs
+The worker/wrapper split mainly affects let-bound /functions/. But we can also use
+demand and CPR information to improve let-bound /thunks/. Specifically:
+
+* (A) Demand-led thunk splitting:
+ If a thunk is demanded strictly, perhaps nestedly, we can turn it into a
+ case, perhaps nestedly. For example
+ let x :: (Int, Int)
+ {- Dmd = SP(S,L) -}
+ x = rhs
+ in body
+ We would ultimately like to get
+ case rhs of x { (a,b) ->
+ case a of { I# a# ->
+ body
+
+ This is much better: no thunk for `rhs`; and known-data-con unfoldings for `x`
+ and `a` inside `body`.
+
+* (B) CPR-led thunk splitting:
+ If a thunk has the (possibly-nested) CPR property /and/ is demanded strictly
+ at top level, we can again generate a case
+ let x :: (Int, Int)
+ {- Dmd = S, Cpr = (_, I# _) -}
+ x = rhs
+ in body
+ The CPR info says that if `x` is evaluated (which it is), it'll return a pair,
+ whose second component can very cheaply be evaluated to a (I# b#). We would
+ like to end up with
+ case rhs of x { (a,b) ->
+ case b of { I# b# ->
+ body
+ which is good for the same reasons as before. See (TS3) for an example.
+
+Implementation
+~~~~~~~~~~~~~~
+The worker/wrapper pass does not generate these nested case expressions directly.
+Instead it generates a regular let-binding but, since the binder is marked as
+strict, any `case` expressions in the RHS will float out. Specifically:
+
+(TS1) For (A), `splitThunkStr` generates the binding
+ let x! = case rhs of { (a,b) ->
+ case a of { I# a# ->
+ (I# a, b)
+ Now when the Simplifier floats the `case` expressions out, we get
+ case rhs of { (a,b) ->
+ case a of { I# a# ->
+ let x = (I# a, b)
in body
+ which is equivalent to the expression in (A) above.
-splitThunk transforms like this:
- let
- x* = let x = x-rhs in
- case x of { I# a -> I# a }
- in body
+ `splitThunkStr` also works on /absent/ thunks: see (TS6).
-This is a little strange: we are re-using the same `x` in the RHS; and
-the RHS takes `x` apart and reboxes it. But because the outer 'let' is
-strict, and the inner let mentions `x` only once, the simplifier
-transform it to
- case x-rhs of
- I# a -> let x* = I# a
- in body
-
-That is good: in `body` we know the form of `x`, which
- * gives the CPR property, and
- * allows case-of-case to happen on x
-
-Notes
-* I tried transforming like this:
- let
- x* = let x = x-rhs in
- case x of { I# a -> x }
- in body
- where I return `x` itself, rather than reboxing it. But this
- turned out to cause some regressions, which I never fully
- investigated.
-
-* Suppose x-rhs is itself a case:
- x-rhs = case e of { T -> I# e1; F -> I# e2 }
- Then we'll get
- join j a = let x* = I# a in body
- in case e of { T -> j e1; F -> j e2 }
- which is good (no boxing). But in the original, unsplit program
- we would transform
- let x* = case e of ... in body
- ==> join j2 x = body
- in case e of { T -> j2 (I# e1); F -> j (I# e2) }
- which is not good (boxing).
+ Rather cleverly, `splitThunkStr` uses `mkWWstr_one`, the /existing/ function
+ argument w/w splitting function, to do the unpacking. This automatically
+ deals with nested strictness.
-* In fact, splitThunk uses the function argument w/w splitting
- function, mkWWstr_one, so that if x's demand is deeper (say U(U(L,L),L))
- then the splitting will go deeper too.
+(TS2) For (B), `splitThunkCpr` behaves exactly analogously, again
+ using `mkWWcpr_one` to do the unpacking. It works only for /demanded/ thunks.
-* For recursive thunks, the Simplifier is unable to float `x-rhs` out of
- `x*`'s RHS, because `x*` occurs freely in `x-rhs`, and will just change it
- back to the original definition, so we just split non-recursive thunks.
+Wrinkles:
-Note [Thunk splitting for top-level binders]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Top-level bindings are never strict. Yet they can be absent, as T14270 shows:
-
- module T14270 (mkTrApp) where
- mkTrApp x y
- | Just ... <- ... typeRepKind x ...
- = undefined
- | otherwise
- = undefined
- typeRepKind = Tick scc undefined
-
-(T19180 is a profiling-free test case for this)
-Note that `typeRepKind` is not exported and its only use site in
-`mkTrApp` guards a bottoming expression. Thus, demand analysis
-figures out that `typeRepKind` is absent and splits the thunk to
-
- typeRepKind =
- let typeRepKind = Tick scc undefined in
- let typeRepKind = absentError in
- typeRepKind
-
-But now we have a local binding with an External Name
-(See Note [About the NameSorts]). That will trigger a CoreLint error, which we
-get around by localising the Id for the auxiliary bindings in 'splitThunk'.
+(TS3) Here's an example of (B), thunk-splitting based on CPR information.
+ Suppose we have
+ let x! = case e of { T -> Just e1; F -> Just e2 }
+ in body
+ If the Simplifier floats the `case` out, we get
+ join j2 x = body
+ in case e of { T -> j2 (Just e1); F -> j2 (Just e2) }
+ which is not good (boxing).
+
+ If we first do the thunk-splitting transformation, we get
+ let x! = case (case e of { T -> Just e1; F -> Just e2 }) of
+ Just a -> Just a
+ in body
+
+ Now when the Simplifier floats we will get:
+ join j a = let x = Just a in body
+ in case e of { T -> j e1; F -> j e2 }
+ which is much better (no boxing).
+
+(TS4) We only do thunk-splitting for thunks that are non-recursive
+ For recursive thunks, the Simplifier is unable to float `rhs` out of
+ x's RHS, because `x` occurs freely in `rhs`, and will just change it
+ back to the original definition.
+
+(TS5) Notice that (B) CPR-led thunk splitting can be useful:
+ * when multi-constructor data types are involved, so that the argument-unboxing
+ mechanism (A) is impotent. See the example in (TS3), which uses `Maybe`.
+ * when the binder is only demanded head-strictly, but CPR has nested information.
+
+ So (A) and (B) have complementary benefits. We might do even better by
+ /combining/ (A) and (B), but at the moment we try (A) first, and then try (B)
+ if (A) is impotent. Combining them would be more work.
+
+(TS6) We can also exploit /absence/. Consider
+ let x {-# Dmd = A #-} = rhs
+ in body
+ Generally speaking `x` will be absent becuase it is passed to functions that
+ don't use it, in which case worker/wrapper on those calls will make `x` unused.
+ But suppose `x` is absent inside a /lazy/ argument:
+ let f p = (fst p, 99) in
+ let x = rhs in
+ f (True, x)
+ Here f's argument is lazy, but `x` is definitely absent, and we could replace
+ `x` with an absent filler. Using (TS1) would give us
+ let x = absentError "urk" in ...
+ which is great.
+
+ So `splitThunkStr` works /regardless/ of the demand on `x`; whether it fires is
+ determined only by the `useful` flag returned by `mkWWstr_one`.
+
+(TS7) Adopting (TS6) leads to one other complication: a top-level binder with
+ an External Name (see Note [About the NameSorts]) can be Absent. If so,
+ it must not be used as a local binder in the `Let` created by `splitThunkStr`.
+ T19180 is a test case for this rather obscure situation.
+
+ Solution: use `localiseId` to localise the binder for the `Let`.
+
+(TS8) Consider out poster child test case for `splitThunkCpr`, in (TS3).
+ x! = case e of { True -> Just 1; False -> Just 2 }
+ But suppose we have `-fworker-wrapper-cbv` enabled (reminder: see
+ Note [Worker/wrapper for strict arguments]). Then alas `splitThunkStr`
+ will fire, but it'll be a no-op in this case. But since it fires, `splitThunkCpr`
+ never gets a chance.
+
+ Hacky but effective solution: switch off `wo_unlift_strict` locally in `splitThunkStr`.
-}
--- | See Note [Thunk splitting].
---
--- splitThunk converts the *non-recursive* binding
+-- | splitThunkStr converts the *non-recursive* binding
-- x = e
-- into
--- x = let x' = e in
--- case x' of I# y -> let x' = I# y in x'
--- See comments above. Is it not beautifully short?
--- Moreover, it works just as well when there are
--- several binders, and if the binders are lifted
--- E.g. x = e
--- --> x = let x' = e in
--- case x' of (a,b) -> let x' = (a,b) in x'
--- Here, x' is a localised version of x, in case x is a
--- top-level Id with an External Name, because Lint rejects local binders with
--- External Names; see Note [About the NameSorts] in GHC.Types.Name.
---
--- How can we do thunk-splitting on a top-level binder? See
--- Note [Thunk splitting for top-level binders].
-splitThunk :: WwOpts -> RecFlag -> Var -> Expr Var -> UniqSM [(Var, Expr Var)]
-splitThunk ww_opts is_rec x rhs
- = assert (not (isJoinId x)) $
- do { let x' = localiseId x -- See comment above
- ; (useful,_args, wrap_fn, fn_arg)
- <- mkWWstr_one ww_opts x' NotMarkedStrict
- ; let res = [ (x, Let (NonRec x' rhs) (wrap_fn fn_arg)) ]
- ; if useful then assertPpr (isNonRec is_rec) (ppr x) -- The thunk must be non-recursive
- return res
- else return [(x, rhs)] }
+-- x = let x = e in
+-- case x of I# y -> I# y
+-- See Note [Thunk splitting].
+splitThunkStr :: WwOpts -> Var -> CoreExpr -> UniqSM (Maybe CoreExpr)
+splitThunkStr ww_opts x rhs
+ = -- NB: does not depend on x's demand being strict; it might be absent, see (TS6)
+ do { let x' = localiseId x -- See (TS7)
+ ww_opts' = ww_opts { wo_unlift_strict = False } -- See (TS8)
+ ; (useful, _transit_vars, wrap_fn, fn_arg) <- mkWWstr_one ww_opts' x' NotMarkedStrict
+ -- Use mkWWstr_one: see (TS1) in Note [Thunk splitting]
+
+ ; if useful
+ then return (Just (Let (NonRec x' rhs) $
+ wrap_fn fn_arg))
+ else return Nothing }
+
+splitThunkCpr :: WwOpts -> Var -> CoreExpr -> UniqSM (Maybe CoreExpr)
+-- See Note [Thunk splitting]
+-- Given x* = rhs, where x* is used outermost-strictly, and x* has a (nested) CPR
+-- property, say Just (Just _), return this new RHS:
+-- let x' = rhs in
+-- case x' of { Just p -> case p of { Just q -> -- Unpacking code
+-- Just (Just q) }} -- Repacking code
+-- Works for multi-constructor data types, where splitThunkStr will fail
+splitThunkCpr ww_opts x rhs
+ | wo_cpr_anal ww_opts -- See (CPR1) in Note [Phase ordering] on GHC.Opt.CprAnal
+ , isStrUsedDmd (idDemandInfo x) -- See (TS2)
+ = assertPpr (cprTypeArity cpr_type == 0) (ppr x) $ -- It's a thunk
+ do { (useful, _transit_vars, rebuild_result, unpacker) <- mkWWcpr_one ww_opts x cpr
+ -- Use mkWWcpr_one: see (TS2) in Note [Thunk splitting]
+ ; if useful
+ then return (Just (Let (NonRec x rhs) $
+ unpacker rebuild_result))
+ else return Nothing }
+
+ | otherwise
+ = return Nothing
+ where
+ cpr_type :: CprType
+ cpr_type = cprSigType (idCprSig x)
+ cpr :: Cpr
+ cpr = cprTypeCpr cpr_type
+
=====================================
compiler/GHC/Core/Opt/WorkWrap/Utils.hs
=====================================
@@ -8,7 +8,7 @@ A library for the ``worker\/wrapper'' back-end to the strictness analyser
{-# LANGUAGE ViewPatterns #-}
module GHC.Core.Opt.WorkWrap.Utils
- ( WwOpts(..), mkWwBodies, mkWWstr, mkWWstr_one
+ ( WwOpts(..), mkWwBodies, mkWWstr, mkWWstr_one, mkWWcpr_one
, needsVoidWorkerArg
, DataConPatContext(..)
, UnboxingDecision(..), canUnboxArg
@@ -139,13 +139,18 @@ data WwOpts
= MkWwOpts
{ -- | Environment of type/data family instances
wo_fam_envs :: !FamInstEnvs
+
, -- | Options for the "Simple optimiser"
wo_simple_opts :: !SimpleOpts
+
, -- | Whether to enable "Constructed Product Result" analysis.
-- (Originally from DOI: 10.1017/S0956796803004751)
+ -- See (CPR1) in Note [Phase ordering] on GHC.Opt.CprAnal
wo_cpr_anal :: !Bool
+
, -- | Used for absent argument error message
wo_module :: !Module
+
, -- | Generate workers even if the only effect is some args get passed
-- unlifted. See Note [WW for calling convention]
wo_unlift_strict :: !Bool }
@@ -230,8 +235,7 @@ mkWwBodies opts fun_id ww_arity arg_vars res_ty demands res_cpr
; let (work_args, work_marks) = unzip work_args_str
-- Do CPR w/w. See Note [Always do CPR w/w]
- ; (useful2, wrap_fn_cpr, work_fn_cpr)
- <- mkWWcpr_entry opts res_ty' res_cpr
+ ; (useful2, wrap_fn_cpr, work_fn_cpr) <- mkWWcpr_entry opts res_ty' res_cpr
; let (work_lam_args, work_call_args, work_call_str)
| needsVoidWorkerArg fun_id arg_vars work_args
@@ -662,8 +666,10 @@ canUnboxResult fam_envs ty cpr
= DontUnbox
where
- -- See Note [non-algebraic or open body type warning]
- open_body_ty_warning = warnPprTrace True "canUnboxResult: non-algebraic or open body type" (ppr ty) Nothing
+ -- See Note [Non-algebraic or open body type warning]
+ open_body_ty_warning
+ = warnPprTrace True "canUnboxResult: non-algebraic or open body type"
+ (ppr ty) Nothing
@@ -808,7 +814,7 @@ match the number of constructor arguments; this happened in #8037.
If so, the worker/wrapper split doesn't work right and we get a Core Lint
bug. The fix here is simply to decline to do w/w if that happens.
-Note [non-algebraic or open body type warning]
+Note [Non-algebraic or open body type warning]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
There are a few cases where the W/W transformation is told that something
returns a constructor, but the type at hand doesn't really match this. One
@@ -829,8 +835,60 @@ This warning also triggers for the stream fusion library within `text`.
We can't easily W/W constructed results like `Stream` because we have no simple
way to express existential types in the worker's type signature.
+Note [Worker/wrapper for strict arguments]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Consider
+ f x = case x of
+ [] -> blah
+ (y:ys) -> f ys
+
+Clearly `f` is strict, but its argument is not a product type, so by default
+we don't worker/wrapper it. But it is arguably valuable to do so. We could
+do this:
+
+ f x = case x of xx { DEFAULT -> $wf xx }
+ $wf xx = case xx of
+ [] -> blah
+ (y:ys) -> f ys
+
+Now the worker `$wf` knows that its argument `xx` will be evaluated
+and properly tagged, so the code for the `case xx` does not need to do
+an "eval" (see `GHC.StgToCmm.Expr.cgCase`). A call (f (a:as)) will
+have the wrapper inlined, and will drop the `case x`, so no eval
+happens at all.
+
+The worker `$wf` is a CBV function (see `Note [CBV Function Ids: overview]`
+in GHC.Types.Id.Info) and the code generator guarantees that every
+call to `$wf` has a properly tagged argument (see `GHC.Stg.EnforceEpt.Rewrite`).
+
+Is this a win? Not always:
+* It can cause slight code size increases. This is since we push evals to every
+ call sites which there might be many. And the evals will only disappear at
+ call sites where we already known that the argument is evaluated.
+
+* It will also cause many more functions to get a worker/wrapper split
+ which can play badly with rules (see Ticket #20364). In particular
+ if you depend on rules firing on functions marked as NOINLINE
+ without marking use sites of these functions as INLINE or INLINEABLE
+ then things will break.
+
+ But if you want a function to match in a RULE, it is /in any case/ good
+ practice to have a `INLINE[1]` or `NOINLNE[1]` pragma, to ensure that it
+ doesn't inline until the rule has had a chance to fire.
+
+So there is a flag, `-fworker-wrapper-cbv`, to control whether we do
+w/w on strict arguments (internally `Opt_WorkerWrapperUnlift`). The
+flag is off by default. The choice is made in
+GHC.Core.Opt.WorkWrap.Utils.wwUseForUnlifting
+
+See also `Note [WW for calling convention]`
+
Note [WW for calling convention]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ NB: This Note is more of a discussion.
+ Read Note [Worker/wrapper for strict arguments] first,
+ which covers the same ground with more precision
+
If we know a function f will always evaluate a particular argument
we might decide that it should rather get evaluated by the caller.
We call this "unlifting" the argument.
@@ -856,10 +914,9 @@ Hence we have the following strategies with different trade-offs:
A) Never do W/W *just* for unlifting of arguments.
+ Very conservative - doesn't break any rules
- - Lot's of performance left on the table
+ - Lots of performance left on the table
-B) Do W/W on just about anything where it might be
- beneficial.
+B) Do W/W on just about anything where it might be beneficial.
+ Exploits pretty much every opportunity for unlifting.
- A bit of compile time/code size cost for all the wrappers.
- Can break rules which would otherwise fire. See #20364.
@@ -883,10 +940,10 @@ C) Unlift *any* (non-boot exported) functions arguments if they are strict.
functionality. I haven't tried this approach because it's not trivial to
implement and doing W/W splits seems to work well enough.
-Currently we use the first approach A) by default, with a flag that allows users
-to fall back to the more aggressive approach B).
+Currently we use the first approach (A) by default, with a flag `-fworker-wrapper-cbv`
+that allows users to fall back to the more aggressive approach (B).
-I also tried the third approach C) using eta-expansion at call sites to avoid
+I also tried the third approach (C) using eta-expansion at call sites to avoid
modifying the PAP-handling code which wasn't fruitful. See
https://gitlab.haskell.org/ghc/ghc/-/merge_requests/5614#note_389903. We could
still try to do C) in the future by having PAP calls which will evaluate the
@@ -895,53 +952,6 @@ be neither a small nor simple change so we stick with A) and a flag for B) for
now.
See also Note [EPT enforcement] and Note [CBV Function Ids: overview]
-
-Note [Worker/wrapper for strict arguments]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Consider
- f x = case x of
- [] -> blah
- (y:ys) -> f ys
-
-Clearly `f` is strict, but its argument is not a product type, so by default
-we don't worker/wrapper it. But it is arguably valuable to do so. We could
-do this:
-
- f x = case x of xx { DEFAULT -> $wf xx }
- $wf xx = case xx of
- [] -> blah
- (y:ys) -> f ys
-
-Now the worker `$wf` knows that its argument `xx` will be evaluated
-and properly tagged, so the code for the `case xx` does not need to do
-an "eval" (see `GHC.StgToCmm.Expr.cgCase`). A call (f (a:as)) will
-have the wrapper inlined, and will drop the `case x`, so no eval
-happens at all.
-
-The worker `$wf` is a CBV function (see `Note [CBV Function Ids: overview]`
-in GHC.Types.Id.Info) and the code generator guarantees that every
-call to `$wf` has a properly tagged argument (see `GHC.Stg.EnforceEpt.Rewrite`).
-
-Is this a win? Not always:
-* It can cause slight codesize increases. This is since we push evals to every
- call sites which there might be many. And the evals will only disappear at
- call sites where we already known that the argument is evaluated.
-
-* It will also cause many more functions to get a worker/wrapper split
- which can play badly with rules (see Ticket #20364). In particular
- if you depend on rules firing on functions marked as NOINLINE
- without marking use sites of these functions as INLINE or INLINEABLE
- then things will break.
- But if you want a function to match in a RULE, it is /in any case/ good practice to
- have a `INLINE[1]` or `NOINLNE[1]` pragma, to ensure that it doesn't inline until
- the rule has had a chance to fire.
-
-So there is a flag, `-fworker-wrapper-cbv`, to control whether we do
-w/w on strict arguments (internally `Opt_WorkerWrapperUnlift`). The
-flag is off by default. The choice is made in
-GHC.Core.Opt.WorkWrape.Utils.wwUseForUnlifting
-
-See also `Note [WW for calling convention]` in GHC.Core.Opt.WorkWrap.Utils
-}
{-
@@ -985,6 +995,12 @@ mkWWstr opts args str_marks
-- * wrap_arg assumes work_args are in scope, and builds a ConApp that
-- reconstructs the RHS of wrap_var that we pass to the original RHS
-- See Note [Worker/wrapper for Strictness and Absence]
+--
+-- E.g. mkWWstr_one (x :: (Int,Int) with strictess saying to unbox the pair and second Int
+-- = ( True -- useful
+-- , [p,q#], -- work_args
+-- , \e -> case x of (p,q) -> case q of I# q# -> e -- wrap_fn
+-- , (p, I# q) ) -- wrap_arg
mkWWstr_one :: WwOpts
-> Var
-> StrictnessMark
@@ -1008,7 +1024,7 @@ mkWWstr_one opts arg str_mark =
DontUnbox
| isStrictDmd arg_dmd || isMarkedStrict str_mark
- , wwUseForUnlifting opts -- See Note [WW for calling convention]
+ , wwUseForUnlifting opts -- See Note [Worker/wrapper for strict arguments]
, not (isFunTy arg_ty)
, not (isUnliftedType arg_ty) -- Already unlifted!
-- NB: function arguments have a fixed RuntimeRep,
@@ -1163,7 +1179,7 @@ function is worthy for splitting:
2b But if e.g. a large tuple or product type is always demanded we might
decide to "unlift" it. That is tighten the calling convention for that
argument to require it to be passed as a pointer to the value itself.
- See Note [WW for calling convention].
+ See Note [Worker/wrapper for strict arguments]
3. In all other cases (e.g., lazy, used demand and not eval'd),
'finaliseArgBoxities' will have cleared the Boxity flag to 'Boxed'
@@ -1604,7 +1620,9 @@ mkWWcpr_entry
CoreExpr -> CoreExpr) -- New worker. 'nop_fn' if not useful
-- ^ Entrypoint to CPR W/W. See Note [Worker/wrapper for CPR] for an overview.
mkWWcpr_entry opts body_ty body_cpr
- | not (wo_cpr_anal opts) = return (boringSplit, nop_fn, nop_fn)
+ | not (wo_cpr_anal opts) -- See (CPR1) in Note [Phase ordering] on GHC.Opt.CprAnal
+ = return (boringSplit, nop_fn, nop_fn)
+
| otherwise = do
-- Part (1)
res_bndr <- mk_res_bndr body_ty
@@ -1637,7 +1655,9 @@ mk_res_bndr body_ty = do
-- 1. A 'WwUse' capturing whether the split does anything useful.
-- 2. The list of transit variables (see the Note).
-- 3. The result builder expression for the wrapper. The original case binder if not useful.
--- 4. The result unpacking expression for the worker. 'nop_fn' if not useful.
+-- Assumes that the transit vars are in scope
+-- 4. The result unpacking expression for the worker. 'nop_fn' if not useful
+-- Brings the transit vars into scope
type CprWwResultOne = (WwUse, OrdList Var, CoreExpr , CoreExpr -> CoreExpr)
type CprWwResultMany = (WwUse, OrdList Var, [CoreExpr], CoreExpr -> CoreExpr)
@@ -1768,7 +1788,7 @@ To achieve said transformation, 'mkWWcpr_entry'
what belongs in the case scrutinee of the unpacker through the communicated
Id `r`: The unpacking expression will be free in that variable.
(This is a similar contract as that of 'mkWWstr_one' for strict args.)
- 3. 'mkWWstr_one' produces a bunch of *transit vars*: Those result variables
+ 3. 'mkWWcpr_one' produces a bunch of *transit vars*: Those result variables
that have to be transferred from the worker to the wrapper, where the
constructed result can be rebuilt, `a` and `b` above. Part (3) is
responsible for tupling them up in the worker and taking the tuple apart
=====================================
compiler/GHC/Types/Cpr.hs
=====================================
@@ -8,6 +8,7 @@
module GHC.Types.Cpr (
Cpr (ConCpr), topCpr, botCpr, flatConCpr, asConCpr,
CprType (..), topCprType, botCprType, flatConCprType,
+ cprTypeArity, cprTypeCpr,
lubCprType, applyCprTy, abstractCprTy, trimCprTy,
UnpackConFieldsResult (..), unpackConFieldsCpr,
CprSig (..), topCprSig, isTopCprSig, mkCprSigForArity, mkCprSig,
@@ -106,6 +107,12 @@ data CprType
-- 'ct_arty' arguments
}
+cprTypeArity :: CprType -> Arity
+cprTypeArity = ct_arty
+
+cprTypeCpr :: CprType -> Cpr
+cprTypeCpr = ct_cpr
+
instance Eq CprType where
a == b = ct_cpr a == ct_cpr b
&& (ct_arty a == ct_arty b || ct_cpr a == topCpr)
@@ -167,7 +174,7 @@ seqCprTy (CprType _ cpr) = seqCpr cpr
-- | The arity of the wrapped 'CprType' is the arity at which it is safe
-- to unleash. See Note [Understanding DmdType and DmdSig] in "GHC.Types.Demand"
-newtype CprSig = CprSig { getCprSig :: CprType }
+newtype CprSig = CprSig { cprSigType :: CprType }
deriving (Eq, Binary)
-- | Turns a 'CprType' computed for the particular 'Arity' into a 'CprSig'
=====================================
compiler/GHC/Utils/Monad.hs
=====================================
@@ -16,7 +16,7 @@ module GHC.Utils.Monad
, mapAccumLM
, mapSndM
, concatMapM
- , mapMaybeM
+ , mapMaybeM, orElseM
, anyM, allM, orM
, foldlM, foldlM_, foldrM, foldMapM
, whenM, unlessM
@@ -250,6 +250,14 @@ unlessM :: Monad m => m Bool -> m () -> m ()
unlessM condM acc = do { cond <- condM
; unless cond acc }
+-- | Monadic version of @orElse@
+infixr 4 `orElseM`
+orElseM :: Monad m => m (Maybe a) -> m a -> m a
+orElseM ma def = do { mb_r <- ma
+ ; case mb_r of
+ Just x -> return x
+ Nothing -> def }
+
-- | Like 'filterM', only it reverses the sense of the test.
filterOutM :: (Applicative m) => (a -> m Bool) -> [a] -> m [a]
filterOutM p =
=====================================
testsuite/tests/simplCore/should_compile/T28158.hs
=====================================
@@ -0,0 +1,22 @@
+{-# OPTIONS_GHC -fworker-wrapper-cbv #-}
+-- Adding this option makes things harder for splitThunkCpr, which
+-- this test is testing. See (TS8) in Note [Thunk splitting]
+
+module T28158 where
+
+-- Here we miss CPR on y
+-- It's a bit of an obscure example, but still; see #28158
+f :: a -> a -> a -> [Int] -> [Int]
+f a b c xs = let y = case xs of
+ [0] -> Just a
+ [1] -> Just b
+ _ -> Just c
+ in h y (case y of
+ Just z -> reverse (reverse (reverse (
+ reverse (reverse (reverse (
+ reverse (reverse xs)))))))
+ Nothing -> xs++xs)
+
+h :: Maybe a -> b -> b
+h (Just y) e = h Nothing e
+h Nothing e = e
=====================================
testsuite/tests/simplCore/should_compile/T28158.stderr
=====================================
@@ -0,0 +1,58 @@
+
+==================== Tidy Core ====================
+Result size of Tidy Core
+ = {terms: 98, types: 108, coercions: 0, joins: 1/1}
+
+Rec {
+$wh
+ = \ @a @b ds e ->
+ case ds of ds1 { __DEFAULT ->
+ case e of e1 { __DEFAULT ->
+ case ds1 of {
+ Nothing -> e1;
+ Just y -> $wh Nothing e1
+ }
+ }
+ }
+end Rec }
+
+h = \ @a @b ds e -> $wh ds e
+
+$wf
+ = \ @a a1 b c xs ->
+ join {
+ $j ww
+ = $wh
+ (Just ww)
+ (reverse1
+ (reverse1
+ (reverse1
+ (reverse1
+ (reverse1 (reverse1 (reverse1 (reverse1 xs []) []) []) []) [])
+ [])
+ [])
+ []) } in
+ case xs of {
+ [] -> jump $j c;
+ : ds ds1 ->
+ case ds of { I# ds2 ->
+ case ds2 of {
+ __DEFAULT -> jump $j c;
+ 0# ->
+ case ds1 of {
+ [] -> jump $j a1;
+ : ipv ipv1 -> jump $j c
+ };
+ 1# ->
+ case ds1 of {
+ [] -> jump $j b;
+ : ipv ipv1 -> jump $j c
+ }
+ }
+ }
+ }
+
+f = \ @a a1 b c xs -> $wf a1 b c xs
+
+
+
=====================================
testsuite/tests/simplCore/should_compile/all.T
=====================================
@@ -637,5 +637,5 @@ test('T27963', [grep_errmsg(r'f/42')], compile, ['-O -ddump-rule-firings'])
test('T27965', normal, compile, ['-O'])
test('T27965a', normal, compile, ['-O'])
test('T27965b', normal, compile, ['-O'])
-
+test('T28158', normal, compile, ['-O -dno-typeable-binds -dsuppress-all -dsuppress-uniques -ddump-simpl'])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1045f6c7f26ecab6e993a63aa567a91…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/1045f6c7f26ecab6e993a63aa567a91…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
25 Nov '26
Simon Peyton Jones pushed to branch wip/T28169 at Glasgow Haskell Compiler / GHC
Commits:
e832b4d2 by Simon Peyton Jones at 2026-11-25T00:48:55+00:00
Progress [skip ci]
- - - - -
5 changed files:
- compiler/GHC/Core/DataCon.hs
- compiler/GHC/Core/SimpleOpt.hs
- compiler/GHC/Core/TyCon.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/Tc/TyCl/Build.hs
Changes:
=====================================
compiler/GHC/Core/DataCon.hs
=====================================
@@ -52,7 +52,6 @@ module GHC.Core.DataCon (
-- ** Predicates on DataCons
isNullarySrcDataCon, isNullaryRepDataCon,
- isLazyDataConRep,
isTupleDataCon, isBoxedTupleDataCon, isUnboxedTupleDataCon,
isUnboxedSumDataCon, isCovertGadtDataCon, isUnaryClassDataCon,
isVanillaDataCon, isNewDataCon, isTypeDataCon, isBoxingDataCon,
@@ -524,21 +523,27 @@ data DataCon
-- See Note [Bangs on data constructor arguments]
dcStricts :: [StrictnessMark],
- -- One mark for every field of the DataCon worker;
- -- if it's empty, then all fields are lazy,
- -- otherwise 1-1 with dataConRepArgTys.
+ -- One mark for every field of the DataCon /worker/
+ -- Lines up 1-1 with dataConRepArgTys
+ -- Relates only to user-specified strictness annotations,
+ -- not to liftedness or othewrise
+ -- E.g. data T a = MkT {-# UNPACK #-} !(S a) Int# !a
+ -- data S a = MkS a !a
+ -- Then the worker for MkT has four fields, the first two arising from
+ -- unpacking S. The corresponding strictness marks are [-,!,-,!]; again
+ -- the first two come from MkS
-- See also Note [Strict fields in Core] in GHC.Core
- -- for the effect on the strictness signature
+ -- for the effect on the strictness signature
dcFields :: [FieldLabel],
-- Field labels for this constructor, in the
-- same order as the dcOrigArgTys;
-- length = 0 (if not a record) or dataConSourceArity.
- dcIsLazy :: Bool
+ dcIsLazy :: Bool,
-- True if (a) all fields of the data con /worker/ are definitely lifted
-- (b) no field has a `StrictnessMark` that forces evaluation
- -- So if `dcIsLazy` is True then all fields are lazy thunks
+ -- So if `dcIsLazy` is True then all fields of the worker are lazy thunks
-- The curried worker function that corresponds to the constructor:
-- It doesn't have an unfolding; the code generator saturates these Ids
@@ -836,7 +841,7 @@ data DataConRep
, dcr_boxer :: DataConBoxer
- , dcr_arg_tys :: [Scaled Type] -- Final, representation argument types,
+ , dcr_arg_tys :: [Scaled Type] -- Final, representation /value/ argument types,
-- after unboxing and flattening,
-- and *including* all evidence args
@@ -1139,30 +1144,39 @@ mkDataCon name declared_infix prom_info
= con
where
is_vanilla = null ex_tvs && null eq_spec && null theta
- str_marks' | no_strict_marks = []
- | otherwise = str_marks
- no_strict_marks = not $ any isMarkedStrict str_marks
- is_lazy = no_str_marks && all definitelyLiftedType rep_arg_tys
-
- con = MkData {dcName = name, dcUnique = nameUnique name,
- dcVanilla = is_vanilla, dcInfix = declared_infix,
- dcUnivTyVars = univ_tvs,
- dcExTyCoVars = ex_tvs,
- dcConcreteTyVars = conc_tvs,
- dcUserTyVarBinders = user_tvbs,
- dcEqSpec = eq_spec,
- dcOtherTheta = theta,
- dcStupidTheta = stupid_theta,
- dcOrigArgTys = orig_arg_tys, dcOrigResTy = orig_res_ty,
- dcRepTyCon = rep_tycon,
- dcSrcBangs = arg_stricts, dcImplBangs = impl_bangs,
- dcStricts = str_marks', dcIsLazy = is_lazy,
- dcFields = fields, dcTag = tag, dcRepType = rep_ty,
- dcWorkId = work_id,
- dcRep = rep,
- dcSourceArity = length orig_arg_tys,
- dcRepArity = length rep_arg_tys + count isCoVar ex_tvs,
- dcPromoted = promoted }
+ is_lazy = not (any isMarkedStrict str_marks)
+ && all (definitelyLiftedType . scaledThing) rep_arg_tys
+
+ con = MkData { dcName = name
+ , dcUnique = nameUnique name
+ , dcInfix = declared_infix
+ , dcTag = tag
+ , dcVanilla = is_vanilla
+
+ , dcUnivTyVars = univ_tvs
+ , dcExTyCoVars = ex_tvs
+ , dcConcreteTyVars = conc_tvs
+ , dcUserTyVarBinders = user_tvbs
+ , dcEqSpec = eq_spec
+ , dcOtherTheta = theta
+ , dcStupidTheta = stupid_theta
+ , dcOrigArgTys = orig_arg_tys
+ , dcOrigResTy = orig_res_ty
+
+ , dcRep = rep
+ , dcRepType = rep_ty
+ , dcRepTyCon = rep_tycon
+ , dcSrcBangs = arg_stricts
+ , dcImplBangs = impl_bangs
+ , dcStricts = assertPpr (equalLength str_marks rep_arg_tys)
+ (ppr name <+> ppr str_marks)
+ str_marks
+ , dcIsLazy = is_lazy
+ , dcFields = fields
+ , dcWorkId = work_id
+ , dcSourceArity = length orig_arg_tys
+ , dcRepArity = length rep_arg_tys + count isCoVar ex_tvs
+ , dcPromoted = promoted }
-- The 'arg_stricts' passed to mkDataCon are simply those for the
-- source-language arguments. We add extra ones for the
@@ -1170,8 +1184,7 @@ mkDataCon name declared_infix prom_info
rep_arg_tys = dataConRepArgTys con
- rep_ty =
- case rep of
+ rep_ty = case rep of
-- If the DataCon has no wrapper, then the worker's type *is* the
-- user-facing type, so we can simply use dataConWrapperType.
NoDataConRep -> dataConWrapperType con
@@ -1407,23 +1420,13 @@ isNullarySrcDataCon dc = dataConSourceArity dc == 0
isNullaryRepDataCon :: DataCon -> Bool
isNullaryRepDataCon dc = dataConRepArity dc == 0
-isLazyDataConRep :: DataCon -> Bool
--- ^ True <==> All fields are lazy
-isLazyDataConRep dc = null (dcStricts dc)
-
dataConRepStrictness :: DataCon -> [StrictnessMark]
-- ^ Give the demands on the runtime arguments of a Core DataCon worker
--- application.
--- The length of the list matches `dataConRepArgTys` (e.g., the number
--- of runtime arguments).
-dataConRepStrictness dc
- | isLazyDataConRep dc
- = replicate (dataConRepArity dc) NotMarkedStrict
- | otherwise
- = dcStricts dc
+-- application. Maches 1-1 with `dataConRepArgTys`
+dataConRepStrictness = dcStricts
-dataConRepLazy :: DataCon -> Bool
-dataConRepLazy = dcIsLazy
+dataConRepIsLazy :: DataCon -> Bool
+dataConRepIsLazy = dcIsLazy
dataConImplBangs :: DataCon -> [HsImplBang]
-- The implementation decisions about the strictness/unpack of each
=====================================
compiler/GHC/Core/SimpleOpt.hs
=====================================
@@ -1726,10 +1726,8 @@ exprIsConApp_maybe ise@(ISE in_scope id_unf) expr
-- See Note [Strict fields in Core] for what a field seq is and (SFC2) for
-- why we insert them
mkFieldSeqFloats in_scope dc args
- | isLazyDataConRep dc
- = (in_scope, nilOL, args)
- | otherwise
- = (in_scope', floats', ty_args ++ val_args')
+ | dataConRepIsLazy dc = (in_scope, nilOL, args) -- Short cut in common case
+ | otherwise = (in_scope', floats', ty_args ++ val_args')
where
(ty_args, val_args) = splitAtList (dataConUnivAndExTyCoVars dc) args
(in_scope', floats', val_args') = foldr do_one (in_scope, nilOL, []) $
=====================================
compiler/GHC/Core/TyCon.hs
=====================================
@@ -1504,14 +1504,16 @@ There are a number of wrinkles
(UCM2) The TyCon for a unary class is /not/ identified as a newtype.
Rather, it has its own AlgTyConRhs, namely `UnaryClassTyCon`
-(UCM3) Unlike non-unary classes, a value of type (C ty), where `C` is a unary
+(UCM3a) Unlike non-unary classes, a value of type (C ty), where `C` is a unary
class, might be bottom, because it is represented by the method type alone.
See GHC.Core.Type.isTerminatingType, and Note [NON-BOTTOM-DICTS invariant]
in GHC.Core
- Similarly in exprOkForSpeculation/exprOkToDiscard/exprOkForSpecEval,
- in GHC.Core.Utils. In the utility funcion `app_ok` we need a special
- case for the DFunIds; they generally terminate, but not for unary classes.
+(UCM3b) We treat the data constructor as if it had a strictness annotation
+ data C a = MkC !(a->a)
+ so that in exprOkForSpeculation/exprOkToDiscard/exprOkForSpecEval, and
+ in exprIsHNF/exprIsConLike, we evaluate the argument. This strictness flag
+ is set in `GHC.Tc.TyCl.buildClass
(UMC4) To avoid regressions, in Core we want to remember that
(MkUC x) is really just x
=====================================
compiler/GHC/Core/Utils.hs
=====================================
@@ -2648,9 +2648,9 @@ exprIsHNFlike is_con is_con_unf rubbish_lit_result e
is_hnf_like e
where
is_hnf_like (Var v) -- NB: There are no value args at this point
- = id_app_is_value v [] -- Catches nullary constructors,
- -- so that [] and () are values, for example
- -- and (e.g.) primops that don't have unfoldings
+ = check_app v [] -- Catches nullary constructors,
+ -- so that [] and () are values, for example
+ -- and (e.g.) primops that don't have unfoldings
|| is_con_unf (idUnfolding v)
-- Check the thing's unfolding; it might be bound to a value
-- or to a guaranteed-evaluated variable (isEvaldUnfolding)
@@ -2685,46 +2685,37 @@ exprIsHNFlike is_con is_con_unf rubbish_lit_result e
= is_hnf_like rhs
is_hnf_like _ = False
- -- Collect arguments through Casts and Ticks and call id_app_is_value
+ -- Collect arguments through Casts and Ticks and call check_app
app_is_value :: CoreExpr -> [CoreArg] -> Bool
- app_is_value (Var f) as = id_app_is_value f as
+ app_is_value (Var f) as = check_app f as
app_is_value (Tick _ f) as = app_is_value f as
app_is_value (Cast f _) as = app_is_value f as
app_is_value (App f a) as | isValArg a = app_is_value f (a:as)
| otherwise = app_is_value f as
app_is_value _ _ = False
- id_app_is_value id val_args
- | Just dc <- isDataConWorkId_maybe id
- , isUnaryClassDataCon dc
- = all is_hnf_like val_args -- Look through unary class data cons
- | otherwise
- -- See Note [exprIsHNF for function applications]
- -- for the specification and examples
+ -- check_app: See Note [exprIsHNF for function applications]
+ -- for the specification and examples
+ check_app id val_args
= case compare (idArity id) (length val_args) of
- EQ | is_con id -> -- Saturated app of a DataCon/CONLIKE Id
- case mb_str_marks id of
- Just str_marks -> -- with strict fields; see (SFC1) of Note [Strict fields in Core]
- assert (val_args `equalLength` str_marks) $
- fields_hnf str_marks
- Nothing -> -- without strict fields: like PAP
- args_hnf -- NB: CONLIKEs are lazy!
-
- GT -> -- PAP: Check unlifted val_args
- args_hnf
-
- _ -> False
+ EQ -> check_saturated id val_args -- Saturated application
+ GT -> check_args id val_args -- Partial application
+ LT -> False -- Over-saturated
+ check_saturated id val_args
+ | Just dc <- isDataConWorkId_maybe id
+ = -- Saturated data constructors; must account for the strictness flags
+ all3Prefix check_field val_args (val_arg_tys id) (dataConStrictness dc)
+ | is_con id -- Saturated CONLIKE: check the arguments
+ = check_args id val_args
+ | otherwise -- Saturated function, not a constructor => not HNF
+ = False
+
+ -- check_args: check that any unlifted args are hnf-like
+ check_args id val_args = assert (sameLength val_args arg_tys) $
+ all2Prefix check_arg val_args arg_tys
where
- -- Saturated, Strict DataCon: Check unlifted val_args and strict fields
- fields_hnf str_marks = all3Prefix check_field val_arg_tys str_marks val_args
-
- -- PAP: Check unlifted val_args
- args_hnf = all2Prefix check_arg val_arg_tys val_args
-
- val_arg_tys = splitUninstantiatedValArgTys (idType id)
- -- val_arg_tys = map exprType val_args, but much less costly.
- -- The obvious definition regresses T16577 by 30% so we don't do it.
+ arg_tys = val_arg_tys id
check_arg a_ty a
| mightBeUnliftedType a_ty = is_hnf_like a
@@ -2735,18 +2726,18 @@ exprIsHNFlike is_con is_con_unf rubbish_lit_result e
-- NB: We check arity (and CONLIKEness) first because it's cheaper
-- and we reject quickly on saturated apps.
- check_field a_ty str a
- | mightBeUnliftedType a_ty = is_hnf_like a
- | isMarkedStrict str = is_hnf_like a
- | otherwise = True
- -- isMarkedStrict: Respect Note [Strict fields in Core]
-
- mb_str_marks id
- | Just dc <- isDataConWorkId_maybe id
- , not (isLazyDataConRep dc)
- = Just (dataConRepStrictness dc)
- | otherwise
- = Nothing
+ -- check_field: used for a data constructor worker:
+ -- check unlifted val_args and strict fields
+ -- See (SFC1) of Note [Strict fields in Core]
+ check_field a a_ty str
+ | mightBeUnliftedType a_ty = is_hnf_like a
+ | isMarkedStrict str = is_hnf_like a
+ | otherwise = True
+
+ val_arg_tys id = splitUninstantiatedValArgTys (idType id)
+ -- val_arg_tys = map exprType val_args, but much less costly.
+ -- The obvious definition regresses T16577 by 30% so we don't do it.
+
{-
Note [exprIsHNF Tick]
=====================================
compiler/GHC/Tc/TyCl/Build.hs
=====================================
@@ -331,6 +331,9 @@ buildClass tycon_name kind binders roles fds sc_theta at_items sig_stuff mindef
univ_bndrs = tyVarSpecToBinders $ tyConInvisTVBinders binders
univ_tvs = binderVars univ_bndrs
bang_opts = FixedBangOpts (map (const HsLazy) args)
+ bangs :: [HsSrcBang]
+ bangs | unary_class = [yes_bang] -- See (UCM3b) in Note [Unary class magic]
+ | otherwise = map (const no_bang) args
; rep_nm <- newTyConRepName datacon_name
; dict_con <- buildDataCon (panic "buildClass: FamInstEnvs")
@@ -338,7 +341,7 @@ buildClass tycon_name kind binders roles fds sc_theta at_items sig_stuff mindef
datacon_name
False -- Not declared infix
rep_nm
- (map (const no_bang) args)
+ bangs
[{- No fields -}]
univ_tvs
[{- no existentials -}]
@@ -376,7 +379,8 @@ buildClass tycon_name kind binders roles fds sc_theta at_items sig_stuff mindef
; traceIf (text "buildClass" <+> ppr tycon)
; return result }
where
- no_bang = HsSrcBang NoSourceText NoSrcUnpack NoSrcStrict
+ no_bang = HsSrcBang NoSourceText NoSrcUnpack NoSrcStrict
+ yes_bang = HsSrcBang NoSourceText NoSrcUnpack SrcStrict
mk_op_item :: Class -> TcMethInfo -> TcRnIf n m ClassOpItem
mk_op_item rec_clas (op_name, _, dm_spec)
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e832b4d2113aabe5ba69efabfbb82ec…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/e832b4d2113aabe5ba69efabfbb82ec…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/case-bndr-unf] 4 commits: Lambda and case binders have vanilla IdInfo (#27965)
by Simon Peyton Jones (@simonpj) 25 Nov '26
by Simon Peyton Jones (@simonpj) 25 Nov '26
25 Nov '26
Simon Peyton Jones pushed to branch wip/case-bndr-unf at Glasgow Haskell Compiler / GHC
Commits:
95079140 by Simon Peyton Jones at 2026-11-25T00:38:11+00:00
Lambda and case binders have vanilla IdInfo (#27965)
Lambda binders, case binders, and case-alternative binders should never
have RULES, a (non-default) inline pragma, or a stable unfolding.
See new Note [Core binder IdInfo invariants] in GHC.Core, which
lays out the invariants.
This patch
* Makes Core Lint check the invariant, using the new predicate
GHC.Types.Id.lamBndrInfoOK.
* Fixes the desugarer, which violated it. For a strict binding
let !x = rhs in body
we generate
let x = rhs in case x of x { DEFAULT -> body }
re-using x (shadowed) as the case binder; see Note [Desugar Strict binds].
But the case binder inherited x's IdInfo, including, say, a NOINLINE
pragma (e.g. `res1` in GHC.Internal.Control.Monad.ST.Lazy.Imp). Now
GHC.HsToCore.Utils.seqVar gives the case binder vanilla IdInfo.
This was not just a matter of taste. For example
h fm s = let {-# NOINLINE res1 #-}
!res1 = fm s
!(f, s') = res1
in (f+1, s')
The NOINLINE case binder becomes a NOINLINE alias `let res3 = res2`,
which is never inlined, and survives (as a silly join point) into the
final code.
* Fixes the Simplifier, which could violate it when duplicating a
StrictBind continuation, which makes a join point
let x = <> in b ==> join j x = b in j <>
If x has any IdInfo that isn't allowed in a lambda-binder, we now zap the
IdInfo in the join point:
let x = <> in b ==> join j x' = b in j <>
where x' is like x (definitely the same unique) but with zapped IdInfo.
See (SB3) in Note [StrictBind].
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
77d3a390 by Simon Peyton Jones at 2026-11-25T00:38:11+00:00
Add varIsHNF, and use it in move_transit_vars
`varIsHNF v` is the same as `exprIsHNF (Var v)`, but avoids building the
Var only to take it apart. The (Var v) case of exprIsHNFlike now uses
the shared varIsHNFlike, so the two cannot drift apart.
In GHC.Core.Opt.WorkWrap.Utils.move_transit_vars we had the guard
isUnliftedType var_ty || exprIsHNF (Var var)
but exprIsHNF is already True of variables of (definitely) unlifted type,
so the isUnliftedType test was redundant. Now it is just (varIsHNF var).
Also make `exprIsHNFlike` treat an application with no value arguments, such as
`f @Int`, exactly like the bare variable `f`, by going through varIsHNFlike.
Otherwise no change in behaviour.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
b603f32f by Simon Peyton Jones at 2026-11-25T00:38:11+00:00
Use SimplClo for the argument of ApplyToVal
This patch renames SimplSR to SimplClo (a "closure"), and uses it not
only as the range of the Simplifier's substitution, but also as the
argument of an ApplyToVal continuation. ApplyToVal used to have three
fields
sc_env :: StaticEnv
sc_arg :: CoreExpr
sc_cast :: MOutCoercion
but now has just
sc_dup :: DupFlag
sc_arg :: SimplClo
An un-simplified argument is (ContEx env arg mco), and an already-simplified
one is (DoneEx arg _). See Note [The argument of ApplyToVal] in
GHC.Core.Opt.Simplify.Utils.
The main payoff is that, since the substitution maps an Id to a SimplClo,
beta-reduction can substitute the argument for the lambda binder without
further ado. Accordingly, preInlineUnconditionally is split into
* preInlineLetUnconditionally, for let-bindings
* preInlineBetaUnconditionally, for beta-redexes, which takes a SimplClo
The latter omits some checks that cannot fire for lambda binders.
Other notes
* The new (ContEx env arg mco) form makes it easy to push a cast into an
argument (mkCloCastMCo), whether or not it has been simplified.
See Note [The MOutCoercion field of ContEx].
* `preInlineUnconditionally` gets split into two variants, one for
let-bindings and one for beta-reduction (which takes a `SimplClo`).
There is a little bit of duplication here, but not much.
* Fixes #27962. The simplifier was previously dropping a cast when dealing
with runRW#. The new `SimplClo` makes that bug much harder to allow.
* Fixes #27963. contOutArgs, which supplies the arguments for Plan (BEFORE)
rule matching, ignored the sc_cast field of ApplyToVal. So in
(f |> co) n ==> f (n |> co1) -- co1 in sc_cast
a rule for `f` saw `f n` rather than `f (n |> co1)`, and failed to match
(the rule matcher checks the types of template variables). If f's
unfolding is active, f may then be inlined, and the rule is lost for
good. Now contOutArgs uses simplCloExpr, which includes the pending cast.
Almost no change in behaviour, except for the #27963 bug-fix.
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
1d59be95 by Simon Peyton Jones at 2026-11-25T00:38:11+00:00
Add splitThunkCpr
This commit adds GHC.Core.Opt.WorkWrap.splitThunkCpr, which adds a form
of "thunk splitting" for strict bindings that have CPR information.
See Note [Thunk splitting] in WorkWrap.hs for the details.
It catches a previously-unrecognised optimisation opportunity
(see #28258) but it only helps in fairly obscure cases, so
I don't expect a big impact in practice.
As usually I did lots of refactoring along the way.
LLM disclosure: lots of interaction with Claude, but I wrote all the
code and comments.
- - - - -
32 changed files:
- + changelog.d/T27962
- + changelog.d/T27963
- compiler/GHC/Builtin/WiredIn/Ids.hs
- compiler/GHC/Core.hs
- compiler/GHC/Core/Lint.hs
- compiler/GHC/Core/Make/Box.hs
- compiler/GHC/Core/Opt/CprAnal.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/WorkWrap.hs
- compiler/GHC/Core/Opt/WorkWrap/Utils.hs
- compiler/GHC/Core/Ppr.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/CoreToStg/Prep.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Utils.hs
- compiler/GHC/Types/Cpr.hs
- compiler/GHC/Types/Id.hs
- compiler/GHC/Utils/Monad.hs
- testsuite/tests/simplCore/should_compile/T15445.stderr
- + testsuite/tests/simplCore/should_compile/T27962.hs
- + testsuite/tests/simplCore/should_compile/T27963.hs
- + testsuite/tests/simplCore/should_compile/T27963.stderr
- + testsuite/tests/simplCore/should_compile/T27965.hs
- + testsuite/tests/simplCore/should_compile/T27965a.hs
- + testsuite/tests/simplCore/should_compile/T27965b.hs
- + testsuite/tests/simplCore/should_compile/T28158.hs
- + testsuite/tests/simplCore/should_compile/T28158.stderr
- testsuite/tests/simplCore/should_compile/all.T
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/27a190029467e53b9b1e4ad9acde3d…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/27a190029467e53b9b1e4ad9acde3d…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/marge_bot_batch_merge_job] 6 commits: Use a different herald for -ddump-simpl-trace
by Marge Bot (@marge-bot) 24 Nov '26
by Marge Bot (@marge-bot) 24 Nov '26
24 Nov '26
Marge Bot pushed to branch wip/marge_bot_batch_merge_job at Glasgow Haskell Compiler / GHC
Commits:
1a69c793 by Simon Peyton Jones at 2026-11-24T18:03:57-05:00
Use a different herald for -ddump-simpl-trace
... so that we can more easily skip the high-volume ones
- - - - -
012d9cf1 by Simon Peyton Jones at 2026-11-24T18:03:57-05:00
Update comments and user manual
This commit addresses the comment-related suggestions in #27973
- - - - -
ad578f71 by Simon Peyton Jones at 2026-11-24T18:03:57-05:00
Document and refactor eta-reduction documentation
Triggered by #27212, this patch does several related things.
* #27212 suggested that `findRhsArity` should ask for eta-expansion
whenever the RHS's `manifestArity` is less than the arity it finds.
That is a misconception: it deliberately compares with `exprArity`,
which counts PAPs, so that we do not eta-expand PAPs (#9020).
Switching to `manifestArity` makes compile time worse in T13960
and T13056.
So this patch changes no code here; we continue to expand only to
increase `exprArity` not `manifestArity`. Instead it documents the
design in `findRhsArity`, `tryEtaExpandRhs`, `wantEtaExpansion` and
Note [Do not eta-expand PAPs] (which now records the #27212
experiment).
* Refactor GHC.Core.Opt.Arity.tryEtaReduce, which was hard to
understand:
- Accumulate an MCoercion rather than a Coercion, so the common
no-cast case builds no coercions at all.
- Separate equations of `go` for type and value arguments. For
value arguments, the new `getTrivialHead_maybe` looks through any
nesting of casts and floatable ticks, and `mkEtaReduceFunCo` builds
the coercion.
- Make the FunCo with `mkFunCo2` and compute its right-hand
FunTyFlag from the coercion kinds. The cast can turn a Type-kinded
argument into a Constraint-kinded one. New test T27212 covers this.
- `mkEtaReduceForAllMCo` builds the ForAllCo for type arguments. It
is tiresomely similar to `mkEtaForAllMCo`, but with the visibilities
the other way round (#24014). It will go away again once !17006
lands.
- New helper `mCoToCo` in GHC.Core.TyCo.Make.
* Drop the checks on multiplicity in `tryEtaReduce`, which sometimes
disabled eta-reduction. For example, (\x. K x) has type Int -> T,
but the data constructor has type K :: Int %1 -> T, so we used to
refuse to eta-reduce it to K.
But Note [Linting linearity] in GHC.Core.Lint (EXAMPLE 4) already
says that we do not preserve linearity under eta-reduction, so this
change just puts that claim into practice. See (EtaMult) in
Note [Eta reduction soundness].
Consequences in the testsuite:
- T18052a: the pattern-synonym builder (\x y. (x,y)) is now just (,).
- T21888a: the NOINLINE function (f x = Just x) becomes (f = Just),
so f loses its CPR signature. The test is about demands, not CPR.
* Tidy up the documentation of eta-reduction:
- Relabel the criteria in Note [Eta reduction soundness] as (EtaA),
(EtaS), (EtaR), (EtaE), (EtaT), (EtaJ), (EtaB) and (EtaW), and
update all references to them. Also fix references to point (2) of
Note [Eta reduction makes sense], which no longer exists.
- Replace the confused "never reduce arity" bullet with an example in
(EtaA), cross-referenced from Note [Arity robustness].
- Add historical notes (EtaMult) and (EtaBot).
- Label the equations in Note [Eta reduction with casted arguments]
(ECA1-4), and point to the code that implements them.
LLM disclosure: I interacted with Claude a lot for this MR, but I
wrote all the code and docs myself.
- - - - -
46bd3331 by Simon Jakobi at 2026-11-24T18:03:58-05:00
ci: Anchor the release branch pattern
Branches with `ghc-X.Y` anywhere in their name, such as
wip/ghc-9.16-backports, were treated as release branches. Each push
started a full-ci branch pipeline next to the merge request pipeline,
and its jobs pushed perf notes.
Fixes #28172.
Assisted-by: Claude Fable 5.2
- - - - -
66cd89d8 by Simon Jakobi at 2026-11-24T18:03:58-05:00
ci: Fix the release branch pattern of lint-submods-branch
The pattern had `[0.9]` for `[0-9]`, so the job didn't run on ghc-10.0.
Also anchor the pattern (#28172).
Assisted-by: Claude Fable 5.2
- - - - -
8da4e77a by Simon Jakobi at 2026-11-24T18:03:59-05:00
ci: Retry some failed jobs automatically
Let GitLab retry a job up to twice when it fails with one of these
reasons:
- runner_system_failure: the runner could not run the job. This is
nearly always an image pull that fails before the job starts.
- stuck_or_timeout_failure: GitLab dropped the job, either because
its runner stopped reporting for an hour or because no runner
picked it up within a day.
Assisted-by: Claude Fable 5.2
- - - - -
28 changed files:
- .gitlab-ci.yml
- .gitlab/ci.sh
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- + changelog.d/T27212
- compiler/GHC/Core/Coercion.hs
- compiler/GHC/Core/Opt/Arity.hs
- compiler/GHC/Core/Opt/OccurAnal.hs
- compiler/GHC/Core/Opt/Pipeline.hs
- compiler/GHC/Core/Opt/Simplify/Env.hs
- compiler/GHC/Core/Opt/Simplify/Inline.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/Opt/SpecConstr.hs
- compiler/GHC/Core/Opt/Specialise.hs
- compiler/GHC/Core/TyCo/Make.hs
- compiler/GHC/Core/Type.hs
- compiler/GHC/Core/Utils.hs
- compiler/GHC/Driver/Config/Core/Opt/Simplify.hs
- compiler/GHC/Utils/Logger.hs
- compiler/Language/Haskell/Syntax/Binds/InlinePragma.hs
- docs/users_guide/debug-info.rst
- docs/users_guide/using-optimisation.rst
- testsuite/tests/dmdanal/sigs/T21888a.stderr
- testsuite/tests/printer/T18052a.stderr
- testsuite/tests/simplCore/should_compile/T24726.stderr
- + testsuite/tests/simplCore/should_compile/T27212.hs
- testsuite/tests/simplCore/should_compile/all.T
Changes:
=====================================
.gitlab-ci.yml
=====================================
@@ -62,6 +62,11 @@ variables:
XZ_OPT: "-1"
default:
interruptible: true
+ retry:
+ max: 2
+ when:
+ - runner_system_failure
+ - stuck_or_timeout_failure
stages:
- not-interruptible
@@ -113,7 +118,7 @@ workflow:
# cause a duplicate pipeline for merge requests coming from the master
# branch of a fork.
- if: $CI_PROJECT_ID == "1" && $CI_COMMIT_BRANCH == "master"
- - if: $CI_PROJECT_ID == "1" && $CI_COMMIT_BRANCH =~ /ghc-[0-9]+\.[0-9]+/
+ - if: $CI_PROJECT_ID == "1" && $CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\.[0-9]+$/
- if: '$CI_PIPELINE_SOURCE == "web"'
# which versions of GHC to allow bootstrap with
@@ -193,7 +198,7 @@ workflow:
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/'
- if: '$CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/'
- if: '$CI_COMMIT_BRANCH == "master"'
- - if: '$CI_COMMIT_BRANCH =~ /ghc-[0-9]+\.[0-9]+/'
+ - if: '$CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\.[0-9]+$/'
############################################################
# Runner Tags
@@ -415,7 +420,7 @@ lint-submods-branch:
- _build/stageBoot/bin/lint-submodule-refs . $(git rev-list $CI_COMMIT_BEFORE_SHA..$CI_COMMIT_SHA)
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- - if: '$CI_COMMIT_BRANCH =~ /ghc-[0.9]+\.[0-9]+/'
+ - if: '$CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\.[0-9]+$/'
- *drafts-can-fail-lint
############################################################
=====================================
.gitlab/ci.sh
=====================================
@@ -496,7 +496,7 @@ function fetch_perf_notes() {
}
function push_perf_notes() {
- if [[ "${CI_COMMIT_BRANCH:-}" != "master" ]] && [[ ! "${CI_COMMIT_BRANCH:-}" =~ ghc-[0-9]+\.[0-9]+ ]]; then
+ if [[ "${CI_COMMIT_BRANCH:-}" != "master" ]] && [[ ! "${CI_COMMIT_BRANCH:-}" =~ ^ghc-[0-9]+\.[0-9]+$ ]]; then
info "Perf notes are only pushed on master/release branches"
return
fi
=====================================
.gitlab/generate-ci/gen_ci.hs
=====================================
@@ -870,7 +870,7 @@ validateRuleString :: ValidateRule -> Cond
validateRuleString FullCI = or_all [ labelString "full-ci"
, labelString "marge_bot_batch_merge_job"
, branchStringExact "master"
- , branchStringLike "ghc-[0-9]+\\.[0-9]+"
+ , branchStringLike "^ghc-[0-9]+\\.[0-9]+$"
]
validateRuleString FastCI = true
=====================================
.gitlab/jobs.yaml
=====================================
@@ -538,7 +538,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\baarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || (($CI_MERGE_REQUEST_LABELS =~ /.*aarch64.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*Windows.*/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\baarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || (($CI_MERGE_REQUEST_LABELS =~ /.*aarch64.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*Windows.*/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -622,7 +622,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\baarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate\\+llvm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || (($CI_MERGE_REQUEST_LABELS =~ /.*aarch64.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*Windows.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\baarch64-linux-deb12-wine-int_native-cross_aarch64-unknown-mingw32-validate\\+llvm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || (($CI_MERGE_REQUEST_LABELS =~ /.*aarch64.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*Windows.*/) && ($CI_MERGE_REQUEST_LABELS =~ /.*LLVM backend.*/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -952,7 +952,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-alpine3_23-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-alpine3_23-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -1014,7 +1014,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-alpine3_23-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-alpine3_23-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -1323,7 +1323,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*i386.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*i386.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -1384,7 +1384,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*i386.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bi386-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*i386.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -10542,7 +10542,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-darwin-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-darwin-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -10610,7 +10610,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-darwin-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-darwin-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -10678,7 +10678,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-freebsd14-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*FreeBSD.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-freebsd14-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*FreeBSD.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -10742,7 +10742,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-freebsd14-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*FreeBSD.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-freebsd14-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*FreeBSD.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -10932,7 +10932,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_12-validate\\+fully_static(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_12-validate\\+fully_static(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -10994,7 +10994,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_12-validate\\+fully_static(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_12-validate\\+fully_static(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -11182,7 +11182,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -11246,7 +11246,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -11312,7 +11312,7 @@
"rules": [
{
"allow_failure": true,
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "manual"
}
],
@@ -11377,7 +11377,7 @@
"rules": [
{
"allow_failure": true,
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-int_native-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "manual"
}
],
@@ -11443,7 +11443,7 @@
"rules": [
{
"allow_failure": true,
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "manual"
}
],
@@ -11508,7 +11508,7 @@
"rules": [
{
"allow_failure": true,
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-alpine3_23-wasm-unreg-cross_wasm32-wasi-release\\+host_fully_static\\+text_simdutf(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*wasm.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "manual"
}
],
@@ -11573,7 +11573,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -11637,7 +11637,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb11-emsdk-closure-int_native-cross_javascript-unknown-ghcjs-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*javascript.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -12071,7 +12071,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-cross_aarch64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-cross_aarch64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -12137,7 +12137,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-int_native-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-int_native-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -12198,7 +12198,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-int_native-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-int_native-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -12261,7 +12261,7 @@
"rules": [
{
"allow_failure": true,
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-no_tntc-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-no_tntc-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "manual"
}
],
@@ -12323,7 +12323,7 @@
"rules": [
{
"allow_failure": true,
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-no_tntc-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-no_tntc-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "manual"
}
],
@@ -12694,7 +12694,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*RISC-V.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-riscv-cross_riscv64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*RISC-V.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -12761,7 +12761,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-unreg-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-unreg-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -12822,7 +12822,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-unreg-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-unreg-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -12884,7 +12884,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -13194,7 +13194,7 @@
"rules": [
{
"allow_failure": true,
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate\\+thread_sanitizer_cmm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate\\+thread_sanitizer_cmm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "manual"
}
],
@@ -13258,7 +13258,7 @@
"rules": [
{
"allow_failure": true,
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate\\+thread_sanitizer_cmm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate\\+thread_sanitizer_cmm(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "manual"
}
],
@@ -13320,7 +13320,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-deb13-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*test-primops.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -13879,7 +13879,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate\\+debug_info\\+ubsan(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate\\+debug_info\\+ubsan(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -13942,7 +13942,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate\\+debug_info\\+ubsan(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-fedora43-validate\\+debug_info\\+ubsan(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/))))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
@@ -14372,7 +14372,7 @@
],
"rules": [
{
- "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /ghc-[0-9]+\\.[0-9]+/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*loongarch.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
+ "if": "((($ONLY_JOBS) && ($ONLY_JOBS =~ /.*\\bx86_64-linux-ubuntu24_04-loongarch-cross_loongarch64-linux-gnu-validate(\\s|$).*/)) || (($ONLY_JOBS == null) && ((($CI_MERGE_REQUEST_LABELS =~ /.*full-ci.*/) || ($CI_MERGE_REQUEST_LABELS =~ /.*marge_bot_batch_merge_job.*/) || ($CI_COMMIT_BRANCH == \"master\") || ($CI_COMMIT_BRANCH =~ /^ghc-[0-9]+\\.[0-9]+$/)) || ($CI_MERGE_REQUEST_LABELS =~ /.*loongarch.*/)))) && ($RELEASE_JOB != \"yes\") && ($NIGHTLY == null)",
"when": "on_success"
}
],
=====================================
changelog.d/T27212
=====================================
@@ -0,0 +1,8 @@
+section: compiler
+synopsis: Tiny change in -drule-check output
+issues: #27212
+mrs: !15954
+description: {
+ The formatting of the heading for the output of ``-drule-check``
+ has changed slightly.
+}
=====================================
compiler/GHC/Core/Coercion.hs
=====================================
@@ -74,7 +74,7 @@ module GHC.Core.Coercion (
isReflCoVar_maybe, assertGoodForAllCo,
- coToMCo, kindCoToMKindCo,
+ coToMCo, kindCoToMKindCo, mCoToCo,
mkTransMCo, mkTransMCoL, mkTransMCoR, mkCastTyMCo, mkSymMCo,
mkFunResMCo, mkPiMCos,
isReflMCo, checkReflexiveMCo,
=====================================
compiler/GHC/Core/Opt/Arity.hs
=====================================
@@ -886,8 +886,14 @@ findRhsArity :: ArityOpts -> RecFlag -> Id -> CoreExpr
-- This implements the fixpoint loop for arity analysis
-- See Note [Arity analysis]
--
--- The Bool is True if the returned arity is greater than (exprArity rhs)
--- so the caller should do eta-expansion
+-- The Bool is True if
+-- the returned arity is greater than (exprArity rhs)
+-- so the caller should do eta-expansion
+-- NB: `exprArity`, not `manifestArity`:
+-- a PAP such as (\x. f x), where f has arity 3, has exprArity 3,
+-- so we do not eta-expand it to (\x y z. f x y z)
+-- See Note [Do not eta-expand PAPs] in GHC.Core.Opt.Simplify.Utils
+--
-- That Bool is never True for join points, which are never eta-expanded
--
-- Returns an SafeArityType that is guaranteed trimmed to typeArity of 'bndr'
@@ -903,10 +909,11 @@ findRhsArity opts is_rec bndr rhs
| otherwise
= (arity_increased, non_join_arity_type)
- -- arity_increased: eta-expand if we'll get more lambdas
- -- to the top of the RHS
+ -- arity_increased: eta-expand if the analysis finds a greater arity
+ -- than exprArity, which already takes account of PAPs
where
- old_arity = exprArity rhs
+ old_arity = exprArity rhs -- See Note [Do not eta-expand PAPs]
+ -- in GHC.Core.Opt.Simplify.Utils
init_env :: ArityEnv
init_env = findRhsArityEnv opts (isJoinId bndr)
@@ -2388,6 +2395,7 @@ mkEtaForAllMCo (Bndr tcv vis) ty mco
-- and is SymCo'd in `etaInfoAbs`. Hence the orientation of the visibility
-- flags. A bit of a brain-strain (#27557).
+
{-
************************************************************************
* *
@@ -2452,16 +2460,20 @@ perform eta reduction on an expression with n leading lambdas `\xs. e xs`
(checked in 'is_eta_reduction_sound' in 'tryEtaReduce', which focuses on the
case where `e` is trivial):
-(A) It is sound to eta-reduce n arguments as long as n does not exceed the
- `exprArity` of `e`. (Needs Arity analysis.)
- This criterion exploits information about how `e` is *defined*.
+(EtaA) It is sound to eta-reduce n arguments as long as n does not exceed the
+ `exprArity` of `e`. (Needs Arity analysis.) This criterion exploits information
+ about how `e` is *defined*. For example:
+ f = \xy. g x y ===> f = g
+ This eta-reduction is good only if `g` has arity at least 2, otherwise
+ f's arity will decrease from 2 to 1.
+ c.f. Note [Arity robustness] in GHC.Core.Opt.Simplify.Env.
- Example: If `e = \x. bot` then we know it won't diverge until it is called
- with one argument. Hence it is safe to eta-reduce `\x. e x` to `e`.
+ Another example: If `e = \x. bot` then we know it won't diverge until it
+ is called with one argument. Hence it is safe to eta-reduce `\x. e x` to `e`.
By contrast, it would be *unsound* to eta-reduce 2 args, `\x y. e x y` to `e`:
`e 42` diverges when `(\x y. e x y) 42` does not.
-(S) It is sound to eta-reduce n arguments in an evaluation context in which all
+(EtaS) It is sound to eta-reduce n arguments in an evaluation context in which all
calls happen with at least n arguments. (Needs Strictness analysis.)
NB: This treats evaluations like a call with 0 args.
NB: This criterion exploits information about how `e` is *used*.
@@ -2483,35 +2495,31 @@ case where `e` is trivial):
But it is unsound to eta-reduce the arg in `g2 (\x y. e x y)` to `g2 e`
when `e = \x. if x then bot else id`, because the latter will diverge when
the former would not. Fortunately, the strictness analyser will report
- "Not always called with two arguments" for `g2` and we won't eta-expand.
+ "Not always called with two arguments" for `g2` and we won't eta-reduce.
See Note [Eta reduction based on evaluation context] for the implementation
details. This criterion is tested extensively in T21261.
-(R) Note [Eta reduction in recursive RHSs] tells us that we should not
+(EtaR) Note [Eta reduction in recursive RHSs] tells us that we should not
eta-reduce `f` in its own RHS and describes our fix.
There we have `f = \x. f x` and we should not eta-reduce to `f=f`. Which
might change a terminating program (think @f `seq` e@) to a non-terminating
one.
-(E) (See fun_arity in tryEtaReduce.) As a perhaps special case on the
- boundary of (A) and (S), when we know that a fun binder `f` is in
- WHNF, we simply assume it has arity 1 and apply (A). Example:
+(EtaE) (See fun_arity in tryEtaReduce.) As a perhaps special case on the
+ boundary of (EtaA) and (EtaS), when we know that a fun binder `f` is in
+ WHNF, we simply assume it has arity 1 and apply (EtaA). Example:
g f = f `seq` \x. f x
Here it's sound eta-reduce `\x. f x` to `f`, because `f` can't be bottom
after the `seq`. This turned up in #7542.
- T. If the binders are all type arguments, it's always safe to eta-reduce,
- regardless of the arity of f.
- /\a b. f @a @b --> f
-
-2. Type and dictionary abstraction. Regardless of whether 'f' is a value, it
+(EtaT) Type and dictionary abstraction. Regardless of whether 'f' is a value, it
is always sound to reduce /type lambdas/, thus:
- (/\a -> f a) --> f
+ (/\a -> f @a) --> f
Moreover, we always want to, because it makes RULEs apply more often:
- This RULE: `forall g. foldr (build (/\a -> g a))`
+ This RULE: `forall g. foldr (build (/\a -> g @a))`
should match `foldr (build (/\b -> ...something complex...))`
- and the simplest way to do so is eta-reduce `/\a -> g a` in the RULE to `g`.
+ and the simplest way to do so is eta-reduce `/\a -> g @a` in the RULE to `g`.
More debatably, we extend this to dictionary arguments too, because the type
checker can insert these eta-expanded versions, with both type and dictionary
@@ -2523,18 +2531,25 @@ case where `e` is trivial):
And here are a few more technical criteria for when it is *not* sound to
eta-reduce that are specific to Core and GHC:
-(J) We may not undersaturate join points.
+(EtaJ) We may not undersaturate join points.
See Note [Invariants on join points] in GHC.Core, and #20599.
-(B) We may not undersaturate functions with no binding.
+(EtaB) We may not undersaturate functions with no binding.
See Note [Eta expanding primops].
-(W) We may not undersaturate StrictWorkerIds.
+(EtaW) We may not undersaturate StrictWorkerIds.
See Note [CBV Function Ids: overview] in GHC.Types.Id.Info.
-Here is a list of historic accidents surrounding unsound eta-reduction:
-* Consider
+Here is a list of historic notes surrounding unsound eta-reduction:
+
+(EtaMult) We used to disable eta-reduction if performing it would change multiplicity.
+ For example:
+ (\x. K x) :: Int -> T but K :: Int %1 -> T
+ But that (a) inhibits beneficial eta-reduction (b) costs extra work to check, and
+ now we don't even try. See Note [Linting linearity] in GHC.Core.Lint, esp EXAMPLE 4
+
+(EtaBot) Consider
f = \x.f x
h y = case (case y of { True -> f `seq` True; False -> False }) of
True -> ...; False -> ...
@@ -2548,16 +2563,6 @@ Here is a list of historic accidents surrounding unsound eta-reduction:
Result: seg-fault because the boolean case actually gets a function value.
See #1947.
-* Never *reduce* arity. For example
- f = \xy. g x y
- Then if h has arity 1 we don't want to eta-reduce because then
- f's arity would decrease, and that is bad
- [SG in 2022: I don't understand this point. There is no `h`, perhaps that
- should have been `g`. Even then, this proposed eta-reduction is invalid by
- criterion (A), which might actually be the point this anecdote is trying to
- make. Perhaps the "no arity decrease" idea is also related to
- Note [Arity robustness]?]
-
Note [Do not eta reduce PAPs]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I considered eta-reducing if the result is a PAP:
@@ -2598,11 +2603,14 @@ This should be eta-reduced to
So we need to accumulate a coercion, pushing it inward (past
variable arguments only) thus:
- f (x |> co_arg) |> co --> (f |> (sym co_arg -> co)) x
- f (x:t) |> co --> (f |> (t -> co)) x
- f @ a |> co --> (f |> (forall a.co)) @ a
- f @ (g:t1~t2) |> co --> (f |> (t1~t2 => co)) @ (g:t1~t2)
-These are the equations for ok_arg.
+(ECA1) \x. f (x |> co_arg) |> co --> (f |> (sym co_arg -> co))
+(ECA2) \x. f (x:t) |> co --> (f |> (t -> co))
+(ECA3) \x. f (x:t1~#t2) |> co --> (f |> (t1~#t2 => co))
+(ECA4) \x. f @ a |> co --> (f |> (forall a.co))
+
+(ECA1,2,4) are implemented by the `go` equations in `tryEtaReduce`.
+However (ECA3) is not implemented -- it could be, perhaps by spotting
+an argument that is (Coercion (CoVar x)), but it seems like a rare case.
Note [Eta reduction with casted function]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2620,7 +2628,7 @@ eta-expansion may be turned off (by sm_eta_expand).
Note [Eta reduction based on evaluation context]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Note [Eta reduction soundness], criterion (S) allows us to eta-reduce
+Note [Eta reduction soundness], criterion (EtaS) allows us to eta-reduce
`g (\x y. e x y)` to `g e` when we know that `g` always calls its parameter with
at least 2 arguments. So how do we read that off `g`'s demand signature?
@@ -2713,13 +2721,13 @@ tryEtaReduce :: UnVarSet -> [Var] -> CoreExpr -> SubDemand -> Maybe CoreExpr
-- and Note [Eta reduction makes sense] when that is the case.
-- and Note [Eta reduction based on evaluation context] for the `eval_sd` arg
tryEtaReduce rec_ids bndrs body eval_sd
- = go (reverse bndrs) body (mkRepReflCo (exprType body))
+ = go (reverse bndrs) body MRefl
where
- incoming_arity = count isId bndrs -- See Note [Eta reduction makes sense], point (2)
+ incoming_arity = count isId bndrs -- See (EtaA) in Note [Eta reduction soundness]
go :: [Var] -- Binders, innermost first, types [a3,a2,a1]
-> CoreExpr -- Of type tr
- -> Coercion -- Of type tr ~ ts
+ -> MCoercion -- Of type tr ~ ts
-> Maybe CoreExpr -- Of type a1 -> a2 -> a3 -> ts
-- See Note [Eta reduction with casted arguments]
-- for why we have an accumulating coercion
@@ -2729,19 +2737,37 @@ tryEtaReduce rec_ids bndrs body eval_sd
-- See Note [Eta reduction with casted function]
go bs (Cast e co1) co2
- = go bs e (co1 `mkTransCo` co2)
+ = go bs e (co1 `mkTransMCoR` co2)
go bs (Tick t e) co
| tickishFloatable t
= fmap (Tick t) $ go bs e co
-- Float app ticks: \x -> Tick t (e x) ==> Tick t e
- go (b : bs) (App fun arg) co
- | Just (co', ticks) <- ok_arg b arg co (exprType fun)
- = fmap (flip (foldr mkTick) ticks) $ go bs fun co'
- -- Float arg ticks: \x -> e (Tick t x) ==> Tick t e
+ -- Implements (ECA4)
+ go all_bs@(b : bs) all_e@(App fun (Type arg_ty)) mco
+ | Just tv <- getTyVar_maybe arg_ty
+ , b == tv
+ , Just (bndr, body_ty) <- splitForAllForAllTyBinder_maybe (exprType fun)
+ = go bs fun (mkEtaReduceForAllMCo bndr body_ty tv mco)
- go remaining_bndrs fun co
+ | otherwise
+ = go_finish all_bs all_e mco
+ -- Want to go to the finish case; see the call
+ -- to (all isTyVar remaining_bndrs) there
+
+ -- Implements (ECA1,2)
+ go (b : bs) (App fun val_arg) mco
+ | Just (v, arg_mco, arg_ticks) <- getTrivialHead_maybe val_arg
+ , b == v
+ , Just co' <- mkEtaReduceFunCo (exprType fun) arg_mco mco
+ = fmap (flip (foldr mkTick) arg_ticks) $
+ go bs fun co'
+ -- Float arg ticks: \x -> e (Tick t x) ==> Tick t e
+
+ go bs fun co = go_finish bs fun co
+
+ go_finish remaining_bndrs fun co
| all isTyVar remaining_bndrs
-- If all the remaining_bnrs are tyvars, then the etad_exp
-- will be trivial, which is what we want.
@@ -2752,7 +2778,7 @@ tryEtaReduce rec_ids bndrs body eval_sd
, remaining_bndrs `ltLength` bndrs
-- Only reply Just if /something/ has happened
, ok_fun fun
- , let used_vars = exprFreeVars fun `unionVarSet` tyCoVarsOfCo co
+ , let used_vars = exprFreeVars fun `unionVarSet` tyCoVarsOfMCo co
reduced_bndrs = mkVarSet (dropList remaining_bndrs bndrs)
-- reduced_bndrs are the ones we are eta-reducing away
, used_vars `disjointVarSet` reduced_bndrs
@@ -2761,10 +2787,10 @@ tryEtaReduce rec_ids bndrs body eval_sd
-- See Note [Eta reduction makes sense], intro and point (1)
-- NB: don't compute used_vars from exprFreeVars (mkCast fun co)
-- because the latter may be ill formed if the guard fails (#21801)
- = Just (mkLams (reverse remaining_bndrs) (mkCast fun co))
+ = Just (mkLams (reverse remaining_bndrs) (mkCastMCo fun co))
- go _remaining_bndrs _fun _ = -- pprTrace "tER fail" (ppr _fun $$ ppr _remaining_bndrs) $
- Nothing
+ | otherwise
+ = Nothing
---------------
-- See Note [Eta reduction makes sense], point (1)
@@ -2777,18 +2803,18 @@ tryEtaReduce rec_ids bndrs body eval_sd
---------------
-- See Note [Eta reduction soundness], this is THE place to check soundness!
is_eta_reduction_sound fun
- | fun `elemUnVarSet` rec_ids -- Criterion (R)
+ | fun `elemUnVarSet` rec_ids -- Criterion (EtaR)
= False -- Don't eta-reduce in fun in its own recursive RHSs
- | cantEtaReduceFun fun -- Criteria (J), (W), (B)
+ | cantEtaReduceFun fun -- Criteria (EtaJ), (EtaW), (EtaB)
= False -- Function can't be eta reduced to arity 0
-- without violating invariants of Core and GHC
| otherwise
= -- Check that eta-reduction won't make the program stricter...
- fun_arity fun >= incoming_arity -- Criterion (A) and (E)
- || all_calls_with_arity incoming_arity -- Criterion (S)
- || all ok_lam bndrs -- Criterion (T)
+ fun_arity fun >= incoming_arity -- Criterion (EtaA) and (EtaE)
+ || all_calls_with_arity incoming_arity -- Criterion (EtaS)
+ || all ok_lam bndrs -- Criterion (EtaT)
all_calls_with_arity n = isStrict (fst $ peelManyCalls n eval_sd)
-- See Note [Eta reduction based on evaluation context]
@@ -2797,57 +2823,76 @@ tryEtaReduce rec_ids bndrs body eval_sd
fun_arity fun
| arity > 0 = arity
| isEvaldUnfolding (idUnfolding fun) = 1
- -- See Note [Eta reduction soundness], criterion (E)
+ -- See Note [Eta reduction soundness], criterion (EtaE)
| otherwise = 0
where
arity = idArity fun
---------------
ok_lam v = isTyVar v || isEvId v
- -- See Note [Eta reduction makes sense], point (2)
-
- ---------------
- ok_arg :: Var -- Of type bndr_t
- -> CoreExpr -- Of type arg_t
- -> Coercion -- Of kind (t1~t2)
- -> Type -- Type (arg_t -> t1) of the function
- -- to which the argument is supplied
- -> Maybe (Coercion -- Of type (arg_t -> t1 ~ bndr_t -> t2)
- -- (and similarly for tyvars, coercion args)
- , [CoreTickish])
- -- See Note [Eta reduction with casted arguments]
- ok_arg bndr (Type arg_ty) co fun_ty
- | Just tv <- getTyVar_maybe arg_ty
- , bndr == tv = case splitForAllForAllTyBinder_maybe fun_ty of
- Just (Bndr _ vis, _) -> Just (fco, [])
- where !fco = mkForAllCo tv vis coreTyLamForAllTyFlag MRefl co
- -- The lambda we are eta-reducing always has visibility
- -- 'coreTyLamForAllTyFlag' which may or may not match
- -- the visibility on the inner function (#24014)
- Nothing -> pprPanic "tryEtaReduce: type arg to non-forall type"
- (text "fun:" <+> ppr bndr
- $$ text "arg:" <+> ppr arg_ty
- $$ text "fun_ty:" <+> ppr fun_ty)
- ok_arg bndr (Var v) co fun_ty
- | bndr == v
- , let mult = idMult bndr
- , Just (_af, fun_mult, _, _) <- splitFunTy_maybe fun_ty
- , mult `eqType` fun_mult -- There is no change in multiplicity, otherwise we must abort
- = Just (mkFunResCo Representational bndr co, [])
- ok_arg bndr (Cast e co_arg) co fun_ty
- | (ticks, Var v) <- stripTicksTop tickishFloatable e
- , Just (_, fun_mult, _, _) <- splitFunTy_maybe fun_ty
- , bndr == v
- , fun_mult `eqType` idMult bndr
- = Just (mkFunCoNoFTF Representational (multToCo fun_mult) (mkSymCo co_arg) co, ticks)
- -- The simplifier combines multiple casts into one,
- -- so we can have a simple-minded pattern match here
- ok_arg bndr (Tick t arg) co fun_ty
- | tickishFloatable t, Just (co', ticks) <- ok_arg bndr arg co fun_ty
- = Just (co', t:ticks)
-
- ok_arg _ _ _ _ = Nothing
+ -- See Note [Eta reduction soundness], point (EtaT)
+
+
+-----------------
+getTrivialHead_maybe :: CoreExpr -> Maybe (Id, MCoercion, [CoreTickish])
+-- (getTrivialHead_maybe e) returns (Just (fn, co,ts))
+-- if `e` looks like (Tick ts (fn |> co)) and ts are floatable
+-- So co :: fn_ty ~ arg_ty
+
+getTrivialHead_maybe (Var v)
+ = Just (v, MRefl, [])
+
+getTrivialHead_maybe (Cast e co_outer)
+ = do { (v, mco_inner, ticks) <- getTrivialHead_maybe e
+ ; return (v, mco_inner `mkTransMCoL` co_outer, ticks) }
+
+getTrivialHead_maybe (Tick t arg)
+ | tickishFloatable t
+ = do { (v, co, ticks) <- getTrivialHead_maybe arg
+ ; return (v, co, t:ticks) }
+
+getTrivialHead_maybe _ = Nothing
+
+-----------------
+mkEtaReduceFunCo :: Type -> MCoercion -> MCoercion -> Maybe MCoercion
+mkEtaReduceFunCo _ MRefl MRefl
+ = Just MRefl -- Very common case
+mkEtaReduceFunCo fun_ty arg_mco res_mco
+ | Just (ftf, mult, arg_ty, res_ty) <- splitFunTy_maybe fun_ty
+ -- fun_ty = arg_ty -> res_ty
+ -- sym arg_mco : arg_ty ~ inner_arg_ty
+ -- res_mco : res_ty ~ outer_res_ty
+ , let arg_co = mCoToCo Representational arg_ty arg_mco
+ res_co = mCoToCo Representational res_ty res_mco
+ mult_co = multToCo mult
+ ftf' = chooseFunTyFlag (coercionLKind arg_co) (coercionRKind res_co)
+ = Just (MCo (mkFunCo2 Representational ftf ftf' mult_co (mkSymCo arg_co) res_co))
+ -- (arg_ty -> res_ty) ~ (inner_arg_ty -> outer_res_ty)
+ | otherwise
+ = Nothing
+-----------------
+mkEtaReduceForAllMCo :: ForAllTyBinder -> Type -> TyVar -> MCoercion -> MCoercion
+-- Very similar to mkEtaForAllMCo, but with
+-- the visibilities the other way around. Tiresome.
+-- mkEtaReduceForAllMCo (forall a[vis]. body_ty) b (co :: ty1 ~ ty2)
+-- (where `b` may be free in `ty1` and `ty2`)
+-- = ForAllCo b[vis]~[spec]. (co :: ty1 ~ ty2)
+-- where `coreTyLamForAllTyFlag` is [spec]
+mkEtaReduceForAllMCo (Bndr fun_tv vis) body_ty tv mco
+ = case mco of
+ MRefl | isCoreTyLamForAllTyFlag vis
+ -- The lambda we are eta-reducing always has visibility
+ -- 'coreTyLamForAllTyFlag' which may or may not match the
+ -- visibility on the inner function (#24014)
+ -> MRefl
+ | otherwise
+ -> MCo $ mkForAllCo fun_tv vis coreTyLamForAllTyFlag MRefl refl_co
+ MCo co -> MCo $ mkForAllCo tv vis coreTyLamForAllTyFlag MRefl co
+ -- Tricky: `fun_tv` scopes over `body_ty` and hence over `refl_co`
+ -- but: `tv` scopes over `mco` and hence over `co`
+ where
+ refl_co = mkRepReflCo body_ty
{- *********************************************************************
* *
=====================================
compiler/GHC/Core/Opt/OccurAnal.hs
=====================================
@@ -42,7 +42,6 @@ import GHC.Core.Utils ( exprIsTrivial, isDefaultAlt, isExpandableApp,
import GHC.Core.Opt.Arity ( joinRhsArity, isOneShotBndr )
import GHC.Core.Coercion
import GHC.Core.Type
-import GHC.Core.TyCo.FVs ( tyCoVarsOfMCo )
import GHC.Data.Maybe( orElse )
import GHC.Data.Graph.Directed ( SCC(..), Node(..)
@@ -2227,7 +2226,7 @@ lambda and casts, e.g.
* Why do we take care to account for intervening casts? Answer:
currently we don't do eta-expansion and cast-swizzling in a stable
- unfolding (see Historical-note [Eta-expansion in stable unfoldings]).
+ unfolding (see Note [Eta expansion in stable unfoldings and rules])
So we can get
f = \x. ((\y. ...x...y...) |> co)
Now, since the lambdas aren't together, the occurrence analyser will
=====================================
compiler/GHC/Core/Opt/Pipeline.hs
=====================================
@@ -352,8 +352,25 @@ runMaybe :: Maybe a -> (a -> CoreToDo) -> CoreToDo
runMaybe (Just x) f = f x
runMaybe Nothing _ = CoreDoNothing
-{- Note [Inline in InitialPhase]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+{- Note [The InitialPhase of the Simplifier]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+The first run of the simplifier, historically called "gentle" simplification,
+has phase=InitialPhase, which does a number of things:
+
+* Usually sm_case_case is switched off in this phase; see
+ Note [Case-of-case and full laziness] and `initGentleSimplMode`
+
+* Inlining, however, is not switched off in InitialPhase.
+ See Note [Inline in InitialPhase]
+
+* Rules can run in InitialPhase
+ Note [RULEs enabled in InitialPhase]
+
+* Lint is a little aggressive about loop-breaker warnings in InitialPhase.
+ See `check_lbs` in `GHC.Core.Lint.perPassFlags`.
+
+Note [Inline in InitialPhase]
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In GHC 8 and earlier we did not inline anything in the InitialPhase. But that is
confusing for users because when they say INLINE they expect the function to inline
right away.
=====================================
compiler/GHC/Core/Opt/Simplify/Env.hs
=====================================
@@ -355,12 +355,18 @@ This simplifier phase is stored in the sm_phase field of SimplMode, usin
the 'SimplPhase' constructor. This allows us to determine which rules/inlinings
are active.
-When we invoke the simplifier on the RHS of a rule, such as 'rhs' above, instead
-of setting the simplifier mode to a single phase, we use a phase range
-corresponding to the range of phases in which the rule is active, with the
-'SimplPhaseRange' constructor. This allows us to check whether other rules or
-inlinings are active throughout the whole activation of the rule.
-See Note [What is active in the RHS of a RULE or unfolding?] in GHC.Core.Opt.Simplify.Utils.
+Wrinkles
+
+(SP1) InitialPhase: see Note [The InitialPhase of the Simplifier]
+ in GHC.Core.Opt.Pipeline.
+
+(SP2) Phase ranges. When we invoke the simplifier on the RHS of a rule, such as
+ `rhs` above, instead of setting the simplifier mode to a single phase, we use a
+ phase /range/ corresponding to the range of phases in which the rule is active,
+ with the 'SimplPhaseRange' constructor. This allows us to check whether other
+ rules or inlinings are active throughout the whole activation of the rule. See
+ Note [What is active in the RHS of a RULE or unfolding?] in
+ GHC.Core.Opt.Simplify.Utils.
-}
instance Outputable SimplMode where
@@ -1234,6 +1240,8 @@ out_id so that its arity is visible in its RHS. Examples:
Example: `f = \x. f x`. See Note [Eta reduction in recursive RHSs] for how
we prevent that.
+c.f. (EtaA) in Note [Eta reduction soundness] in GHC.Core.Opt.Arity.
+
Note [Robust OccInfo]
~~~~~~~~~~~~~~~~~~~~~
It's important that we *do* retain the loop-breaker OccInfo, because
=====================================
compiler/GHC/Core/Opt/Simplify/Inline.hs
=====================================
@@ -126,11 +126,6 @@ activeUnfolding mode id
| otherwise
= isActive (sm_phase mode) (idInlineActivation id)
&& sm_inline mode
- -- `or` isStableUnfolding (realIdUnfolding id)
- -- Inline things when
- -- (a) they are active
- -- (b) sm_inline says so, except that for stable unfoldings
- -- (ie pragmas) we inline anyway
-- | Report the inlining of an identifier's RHS to the user, if requested.
traceInline :: Logger -> UnfoldingOpts -> Id -> String -> SDoc -> a -> a
=====================================
compiler/GHC/Core/Opt/Simplify/Iteration.hs
=====================================
@@ -3143,7 +3143,7 @@ There have been various earlier versions of this patch:
case_bndr_evald_next _ = False
This patch was part of fixing #7542. See also
- Note [Eta reduction soundness], criterion (E) in GHC.Core.Utils.)
+ Note [Eta reduction soundness], criterion (EtaE) in GHC.Core.Opt.Arity.)
Further notes about case elimination
@@ -4959,7 +4959,7 @@ eta-expand the stable unfolding to arity N too. Simple and consistent.
Wrinkles
-* See Historical-note [Eta-expansion in stable unfoldings] in
+* See Note [Eta expansion in stable unfoldings and rules]
GHC.Core.Opt.Simplify.Utils
* Don't eta-expand a trivial expr, else each pass will eta-reduce it,
=====================================
compiler/GHC/Core/Opt/Simplify/Utils.hs
=====================================
@@ -1319,43 +1319,6 @@ But this old note is no longer relevant because the specialiser has
improved: see Note [Account for casts in binding] in
GHC.Core.Opt.Specialise. So we seem to have a free choice.
-Note [Inlining in gentle mode]
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Something is inlined if
- (i) the sm_inline flag is on, AND
- (ii) the thing has an INLINE pragma, AND
- (iii) the thing is inlinable in the earliest phase.
-
-Example of why (iii) is important:
- {-# INLINE [~1] g #-}
- g = ...
-
- {-# INLINE f #-}
- f x = g (g x)
-
-If we were to inline g into f's inlining, then an importing module would
-never be able to do
- f e --> g (g e) ---> RULE fires
-because the stable unfolding for f has had g inlined into it.
-
-On the other hand, it is bad not to do ANY inlining into an
-stable unfolding, because then recursive knots in instance declarations
-don't get unravelled.
-
-However, *sometimes* SimplGently must do no call-site inlining at all
-(hence sm_inline = False). Before full laziness we must be careful
-not to inline wrappers, because doing so inhibits floating
- e.g. ...(case f x of ...)...
- ==> ...(case (case x of I# x# -> fw x#) of ...)...
- ==> ...(case x of I# x# -> case fw x# of ...)...
-and now the redex (f x) isn't floatable any more.
-
-The no-inlining thing is also important for Template Haskell. You might be
-compiling in one-shot mode with -O2; but when TH compiles a splice before
-running it, we don't want to use -O2. Indeed, we don't want to inline
-anything, because the byte-code interpreter might get confused about
-unboxed tuples and suchlike.
-
Note [What is active in the RHS of a RULE or unfolding?]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppose we have either a RULE or a stable unfolding with an explicit activation:
@@ -1448,7 +1411,7 @@ First, consider the following example
Now, if that's the ONLY occurrence of f, it might be inlined inside g,
and thence copied multiple times when g is inlined. HENCE we treat
any occurrence in a stable unfolding as a multiple occurrence, not a single
-one; see OccurAnal.addRuleUsage.
+one; see Note [Occurrences in stable unfoldings and RULES] in GHC.Core.Opt.OccurAnal.
Second, we must be careful when simplifying the RHS that we do not apply RULES
which are not active over the whole active range of the stable unfolding.
@@ -1477,17 +1440,6 @@ strictness wrapper get activation (ActiveAfter 0). So the strictness
wrepper fails the test and won't be inlined into f's stable unfolding. That
means f can inline, expose the specialised call to g, so the specialisation
rules can fire.
-
-A note about wrappers
-~~~~~~~~~~~~~~~~~~~~~
-It's also important not to inline a worker back into a wrapper.
-A wrapper looks like
- wraper = inline_me (\x -> ...worker... )
-Normally, the inline_me prevents the worker getting inlined into
-the wrapper (initially, the worker's only call site!). But,
-if the wrapper is sure to be called, the strictness analyser will
-mark it 'demanded', so when the RHS is simplified, it'll get an ArgOf
-continuation.
-}
getUnfoldingInRuleMatch :: SimplEnv -> InScopeEnv
@@ -2158,8 +2110,9 @@ tryEtaExpandRhs :: SimplEnv -> BindContext -> OutId -> OutExpr
tryEtaExpandRhs env bind_cxt bndr rhs
| seEtaExpand env -- If Eta-expansion is on
, wantEtaExpansion rhs -- and we'd like to eta-expand e
- , do_eta_expand -- and e's manifest arity is lower than
- -- what it could be
+ , do_eta_expand -- and arity analysis finds a greater arity
+ -- than (exprArity e); NB: not manifestArity
+ -- See Note [Do not eta-expand PAPs]
-- (never true for join points)
= -- Do eta-expansion.
assertPpr( not (isJoinBC bind_cxt) ) (ppr bndr) $
@@ -2178,7 +2131,8 @@ tryEtaExpandRhs env bind_cxt bndr rhs
(do_eta_expand, arity_type) = findRhsArity arity_opts is_rec bndr rhs
wantEtaExpansion :: CoreExpr -> Bool
--- Mostly True; but False of PAPs which will immediately eta-reduce again
+-- Mostly True; but False of trivial RHSs, and of PAPs at the top of the RHS
+-- (PAPs under value lambdas are dealt with by findRhsArity)
-- See Note [Which RHSs do we eta-expand?]
wantEtaExpansion (Cast e _) = wantEtaExpansion e
wantEtaExpansion (Tick _ e) = wantEtaExpansion e
@@ -2195,24 +2149,6 @@ We now eta expand at let-bindings, which is where the payoff comes.
The most significant thing is that we can do a simple arity analysis
(in GHC.Core.Opt.Arity.findRhsArity), which we can't do for free-floating lambdas
-One useful consequence of not eta-expanding lambdas is this example:
- genMap :: C a => ...
- {-# INLINE genMap #-}
- genMap f xs = ...
-
- myMap :: D a => ...
- {-# INLINE myMap #-}
- myMap = genMap
-
-Notice that 'genMap' should only inline if applied to two arguments.
-In the stable unfolding for myMap we'll have the unfolding
- (\d -> genMap Int (..d..))
-We do not want to eta-expand to
- (\d f xs -> genMap Int (..d..) f xs)
-because then 'genMap' will inline, and it really shouldn't: at least
-as far as the programmer is concerned, it's not applied to two
-arguments!
-
Note [Which RHSs do we eta-expand?]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We don't eta-expand:
@@ -2234,7 +2170,22 @@ seems like a Good idea.
Note [Do not eta-expand PAPs]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-We used to have old_arity = manifestArity rhs, which meant that we
+We do not eta-expand a RHS that is a partial application (PAP). This
+is achieved in two places:
+
+(DEP1) A PAP at the top of the RHS, such as
+ f = g d -- g has arity 2
+ is rejected by `wantEtaExpansion`.
+
+(DEP2) A PAP under value lambdas, such as
+ f = \x. g x -- g has arity 3
+ is not eta-expanded because `findRhsArity` asks for eta-expansion
+ only if the arity it finds is greater than (exprArity rhs), and
+ `exprArity` takes account of PAPs: here (exprArity rhs) = 3.
+ Using `manifestArity` (which is 1 here) instead would eta-expand
+ to f = \x y z. g x y z.
+
+Up to 2014 we used old_arity = manifestArity rhs, which meant that we
would eta-expand even PAPs. But this gives no particular advantage,
and can lead to a massive blow-up in code size, exhibited by #9020.
Suppose we have a PAP
@@ -2250,6 +2201,17 @@ coercions and whatnot that eventually disappear again. For T9020, GHC
allocated 6.6G before, and 0.8G afterwards; and residency dropped from
1.8G to 45M.
+#27212 tried switching (DEP2) back to manifestArity, with these results:
+
+* T13960: bytestring's
+ cstring1 = \(a::Addr#) @r. cstring2 @r a -- cstring2 has arity 4
+ was eta-expanded to (\a @r k br s. cstring2 @r a k br s). That bigger
+ unfolding is inlined at every string literal, adding 6 terms per
+ literal; compile-time allocation went up by 9%.
+
+* T13056: a derived-instance method (\ @a d. lvl @a), where `lvl` is
+ bottoming, was eta-expanded, and then needlessly worker/wrappered.
+
Moreover, if we eta expand
f = g d ==> f = \x. g d x
that might in turn make g inline (if it has an inline pragma), which
@@ -2261,6 +2223,24 @@ But note that this won't eta-expand, say
Does it matter not eta-expanding such functions? I'm not sure. Perhaps
strictness analysis will have less to bite on?
+One useful consequence of not eta-expanding PAPs is this example:
+ genMap :: C a => ...
+ {-# INLINE genMap #-}
+ genMap f xs = ...
+
+ myMap :: D a => ...
+ {-# INLINE myMap #-}
+ myMap = genMap
+
+Notice that 'genMap' should only inline if applied to two arguments.
+In the stable unfolding for myMap we'll have the unfolding
+ (\d -> genMap Int (..d..))
+We do not want to eta-expand to
+ (\d f xs -> genMap Int (..d..) f xs)
+because then 'genMap' will inline, and it really shouldn't: at least
+as far as the programmer is concerned, it's not applied to two
+arguments!
+
************************************************************************
* *
=====================================
compiler/GHC/Core/Opt/SpecConstr.hs
=====================================
@@ -684,7 +684,7 @@ But regardless, SpecConstr can and should! It's easy:
Wrinkles:
* This should all work perfectly fine for newtype classes. Mind you,
- currently newtype classes are inlined fairly agressively, but we
+ currently newtype classes are inlined fairly aggressively, but we
may change that. And it would take extra code to exclude them, as
well as being unnecessary.
=====================================
compiler/GHC/Core/Opt/Specialise.hs
=====================================
@@ -3345,7 +3345,7 @@ pair_fvs :: (Id, CoreExpr) -> VarSet
pair_fvs (bndr, rhs) = exprSomeFreeVars interesting rhs
`unionVarSet` bndrFreeVars bndr
-- bndrFreeVars: don't forget variables mentioned in
- -- the rules of the bndr. C.f. OccAnal.addRuleUsage
+ -- the rules or unfolding of the bndr.
-- Also tyvars mentioned in its type; they may not appear
-- in the RHS
-- type T a = Int
=====================================
compiler/GHC/Core/TyCo/Make.hs
=====================================
@@ -58,7 +58,7 @@ module GHC.Core.TyCo.Make (
, mkAxInstCo
, mkTransCo, mkTransMCo, mkTransMCoL, mkTransMCoR
, mkProofIrrelCo
- , coToMCo, kindCoToMKindCo
+ , coToMCo, kindCoToMKindCo, mCoToCo
, mkCoherenceLeftCo, mkCoherenceRightCo, mkCoherenceRightMCo
, toPhantomCo, mkPhantomCo
, isReflCo, isReflMCo, isReflKindCo, isReflKindMCo, isReflCo_maybe
@@ -860,7 +860,7 @@ mkHomoForAllCos vs orig_co
= foldr go orig_co vs
where
go :: ForAllTyBinder -> Coercion -> Coercion
- go (Bndr var vis) co = mk_forall_co var vis vis MRefl co
+ go (Bndr var vis) co = mkForAllCoNonRefl var vis vis MRefl co
mkHomoForAllCo :: TyVar -> Coercion -> Coercion
-- Specialised for a single TyVar,
@@ -869,7 +869,7 @@ mkHomoForAllCo tv orig_co
| Just (ty, r) <- isReflCo_maybe orig_co
= mkReflCo r (mkForAllTy (Bndr tv vis) ty)
| otherwise
- = mk_forall_co tv vis vis MRefl orig_co
+ = mkForAllCoNonRefl tv vis vis MRefl orig_co
where
vis = coreTyLamForAllTyFlag
@@ -892,15 +892,15 @@ mkForAllCo v visL visR kind_co co
| Just refl_co <- isReflForAllCo v visL visR kind_co co
= refl_co
| otherwise
- = mk_forall_co v visL visR kind_co co
+ = mkForAllCoNonRefl v visL visR kind_co co
--- | `mk_forall_co` just builds a ForAllCo.
+-- | `mkForAllCoNonRefl` just builds a ForAllCo.
-- With debug on, it checks invariants (e.g. he kind of the tycovar should
-- be the left-hand kind of the kind coercion).
-- Callers should have done any isReflCo short-cutting.
-mk_forall_co :: TyCoVar -> ForAllTyFlag -> ForAllTyFlag
- -> KindMCoercion -> Coercion -> Coercion
-mk_forall_co tcv visL visR kind_co co
+mkForAllCoNonRefl :: TyCoVar -> ForAllTyFlag -> ForAllTyFlag
+ -> KindMCoercion -> Coercion -> Coercion
+mkForAllCoNonRefl tcv visL visR kind_co co
= assertGoodForAllCo tcv visL visR kind_co co $
assertPpr (not (isReflCo co && isReflMCo kind_co && visL `eqForAllVis` visR)) (ppr co) $
ForAllCo { fco_tcv = tcv, fco_visL = visL, fco_visR = visR
@@ -1289,6 +1289,10 @@ coToMCo :: Coercion -> MCoercion
coToMCo co | isReflCo co = MRefl
| otherwise = MCo co
+mCoToCo :: Role -> Type -> MCoercion -> Coercion
+mCoToCo role ty MRefl = mkReflCo role ty
+mCoToCo _ _ (MCo co) = co
+
kindCoToMKindCo :: KindCoercion -> KindMCoercion
-- Convert a KindCoercion to a KindMCoercion,
-- coToMCo doesn't eliminate GRefl, but kindCoToMCo can
=====================================
compiler/GHC/Core/Type.hs
=====================================
@@ -160,7 +160,7 @@ module GHC.Core.Type (
-- * Type free variables
tyCoVarsOfType, tyCoVarsOfTypes, tyCoVarsOfTypeDSet,
- coVarsOfType, coVarsOfTypes,
+ tyCoVarsOfMCo, coVarsOfType, coVarsOfTypes,
anyFreeVarsOfType, anyFreeVarsOfTypes,
noFreeVarsOfType,
=====================================
compiler/GHC/Core/Utils.hs
=====================================
@@ -2392,7 +2392,7 @@ canCollectArgsThroughTick id t
= tickishFloatable t || cantEtaReduceFun id
-- | Can we eta-reduce the given function?
--- See Note [Eta reduction soundness], criteria (B), (J), and (W).
+-- See Note [Eta reduction soundness], criteria (EtaB), (EtaJ), and (EtaW).
cantEtaReduceFun :: Id -> Bool
cantEtaReduceFun fun
= hasNoBinding fun -- (B)
@@ -3295,17 +3295,16 @@ Now
the caller guarantees to pass an EPT argument (see Note [EPT enforcement] in
GHC.Core.Stg.EnforceEpt)
- * The code generator will discard that "extra eval" case, because $wfoo is
- CBV.
+ * The code generator will discard that "extra eval" case, because $wfoo is CBV.
See also Note [CBV Function Ids: overview].
-In tihs case the argument is known to be properly tagged at the call site so there is
+In this case the argument is known to be properly tagged at the call site so there is
no additional work for the caller and the worker can be more efficient since it can
assume the presence of a tag.
This is especially true for recursive functions like this:
- -- myPred expect it's argument properly tagged
+ -- myPred expects its argument properly tagged
-- The EnforceEPT pass has made it a CBV function
myPred !x = ...
@@ -3414,16 +3413,17 @@ This note deals with the second part.
There are multiple reasons why we might not want to insert a seq in the rhs to
strictify a functions argument:
-1) The argument doesn't exist at runtime.
- For zero width types (like Types) there is no benefit as we don't operate on them
- at runtime at all. This includes things like void#, coercions and state tokens.
+(WIS1) The argument doesn't exist at runtime: types are erased.
-2) The argument is a unlifted type.
- If the argument is a unlifted type the calling convention already is explicitly
+(WIS2) For zero width types there is no benefit as we don't operate on them at
+ runtime at all. This includes things like void#, coercions and state tokens.
+
+(WIS3) The argument is a unlifted type.
+ If the argument is an unlifted type the calling convention already is explicitly
cbv. This means inserting a seq on this argument wouldn't do anything as the seq
would be a no-op *and* it wouldn't affect the calling convention.
-3) The argument is absent.
+(WIS4) The argument is absent.
If the argument is absent in the body there is no advantage to it being passed as
cbv to the function. The function won't ever look at it so we don't save any work.
@@ -3445,7 +3445,7 @@ strictify a functions argument:
Note [Absent fillers] has an example of this. However this is so rare it's not worth
caring about here.
-5) Functions
+(WIS5) Functions
Functions are tricky (see Note [TagInfo of functions] in EnforceEpt).
But the gist of it even if we make a higher order function argument strict
we can't avoid the tag check when it's used later in the body.
@@ -3453,7 +3453,7 @@ strictify a functions argument:
Wrinkles:
-(WIS1) You might have thought that we can omit the eval if the argument is used
+(WIS6) You might have thought that we can omit the eval if the argument is used
strictly demanded in the body. But you'd be wrong. Consider this code:
data T = MkT ![Int]
f t = case t of MkT xs{Dmd=STR} -> reverse xs
@@ -3509,25 +3509,30 @@ Wrinkles:
wantCbvForId :: Var -> Bool
wantCbvForId v
-- Must be a runtime var.
- -- See Note [Which Ids should be strictified] point 1)
- | isId v
- , not $ isZeroBitTy ty
+ -- See (WIS1) in Note [Which Ids should be strictified]
+ | not (isRuntimeVar v) = False
+
+ -- Not zero-width value
+ -- See (WIS2) in Note [Which Ids should be strictified]
+ | isZeroBitTy ty = False
+
-- Unlifted things don't need special measures to be treated as cbv
- -- See Note [Which Ids should be strictified] point 2)
- , mightBeLiftedType ty
+ -- See (WIS3) in Note [Which Ids should be strictified]
+ | definitelyUnliftedType ty = False
+
+ -- If the var is absent, don't add a seq
+ -- See (WIS4) in Note [Which Ids should be strictified]
+ | isAbsDmd (idDemandInfo v) = False
+
-- Functions sometimes get a zero tag so we can't eliminate the tag check.
-- See Note [TagInfo of functions] in EnforceEpt.
- -- See Note [Which Ids should be strictified] point 5)
- , not $ isFunTy ty
- -- If the var is strict already a seq is redundant.
- -- See Note [Which Ids should be strictified] point 4)
- , not (isAbsDmd dmd)
- = True
- | otherwise
- = False
+ -- See (WIS5) in Note [Which Ids should be strictified]
+ | isFunTy ty = False
+
+ -- Finally! We should add a `seq`
+ | otherwise = True
where
ty = idType v
- dmd = idDemandInfo v
{- *********************************************************************
* *
=====================================
compiler/GHC/Driver/Config/Core/Opt/Simplify.hs
=====================================
@@ -77,6 +77,7 @@ initSimplMode dflags phase name = SimplMode
}
initGentleSimplMode :: DynFlags -> SimplMode
+-- See Note [The InitialPhase of the Simplifier] in GHC.Core.Opt.Pipeline
initGentleSimplMode dflags = (initSimplMode dflags InitialPhase "Gentle")
{ -- Don't do case-of-case transformations.
-- This makes full laziness work better
=====================================
compiler/GHC/Utils/Logger.hs
=====================================
@@ -485,7 +485,7 @@ dumpSDocWithStyle dumps log_action sty logflags flag hdr doc =
let d = timeStamp
$$ blankLine
$$ doc
- return $ mkDumpDoc hdr d
+ return $ mkDumpDoc herald d
-- When we dump to files we use UTF8. Which allows ascii spaces.
defaultLogActionHPrintDoc logflags True handle (withPprStyle sty doc')
@@ -493,9 +493,15 @@ dumpSDocWithStyle dumps log_action sty logflags flag hdr doc =
writeDump Nothing = do
let (doc', msg_class)
| null hdr = (doc, MCOutput)
- | otherwise = (mkDumpDoc hdr doc, MCDump)
+ | otherwise = (mkDumpDoc herald doc, MCDump)
log_action logflags msg_class noSrcSpan (withPprStyle sty doc')
+ -- We use a different herald for some dumps, so that we
+ -- can more easily skip the high-volume ones
+ herald = line <+> text hdr <+> line
+ line = case flag of
+ Opt_D_dump_simpl_trace -> text "-------"
+ _ -> text "===================="
-- | Run an action with the handle of a 'DumpFlag' if we are outputting to a
-- file, otherwise 'Nothing'.
@@ -600,18 +606,17 @@ logTraceMsg logger hdr doc a = putTraceMsg logger (logFlags logger) hdr doc a
-- | Log a dump message (not a dump file)
logDumpMsg :: Logger -> String -> SDoc -> IO ()
-logDumpMsg logger hdr doc = logMsg logger MCDump noSrcSpan
- (withPprStyle defaultDumpStyle
- (mkDumpDoc hdr doc))
-
-mkDumpDoc :: String -> SDoc -> SDoc
-mkDumpDoc hdr doc
- = vcat [blankLine,
- line <+> text hdr <+> line,
- doc,
- blankLine]
- where
- line = text "===================="
+logDumpMsg logger hdr doc
+ = logMsg logger MCDump noSrcSpan
+ (withPprStyle defaultDumpStyle
+ (mkDumpDoc herald doc))
+ where
+ herald = text "------" <+> text hdr <+> text "------"
+
+mkDumpDoc :: SDoc -- Herald
+ -> SDoc -- Payload
+ -> SDoc
+mkDumpDoc herald doc = vcat [blankLine, herald, doc, blankLine]
-- | Dump if the given DumpFlag is set
=====================================
compiler/Language/Haskell/Syntax/Binds/InlinePragma.hs
=====================================
@@ -124,11 +124,15 @@ Note [inl_inline and inl_act]
INLINABLE, OPAQUE, or nothing at all
* inl_act says in what phases the unfolding is active or inactive
- E.g If you write INLINE[1] then inl_act will be set to ActiveAfter 1
- If you write NOINLINE[1] then inl_act will be set to ActiveBefore 1
- If you write NOINLINE[~1] then inl_act will be set to ActiveAfter 1
- So note that inl_act does not say what pragma you wrote: it just
- expresses its consequences
+ E.g If you write then inl_act will be set to
+ INLINE AlwaysActive
+ INLINE[1] ActiveAfter 1
+ INLINE[~1] ActiveBefore 1
+ NOINLINE[1] ActiveAfter 1
+ NOINLINE[~1] ActiveBefore 1
+ NOINLINE NeverActive
+ So note that inl_act does not say what pragma you wrote:
+ it just expresses its consequences
* inl_act just says when the unfolding is active; it doesn't say what
to inline. If you say INLINE f, then f's inl_act will be AlwaysActive,
=====================================
docs/users_guide/debug-info.rst
=====================================
@@ -69,8 +69,9 @@ Here we used the ``-g`` option to inform GHC that it should add debugging
information in the produced binary. There are three levels of debugging
output: ``-g0`` (no debugging information, the default), ``-g1`` (sufficient for
basic backtraces), ``-g2`` (or just ``-g`` for short; emitting everything GHC knows).
-Note that this debugging information does not affect the optimizations performed
-by GHC.
+Note that this debugging information does not affect the optimizations
+that GHC attempts to perform; but it can affect how successful it is in
+performing them (see #21471, #27687).
.. tip::
Under Mac OS X debug information is kept apart from the executable. After
=====================================
docs/users_guide/using-optimisation.rst
=====================================
@@ -1817,7 +1817,7 @@ as such you shouldn't need to set any of them explicitly. A flag
:type: dynamic
:category:
- :default: 80
+ :default: 90
.. index::
single: inlining, controlling
=====================================
testsuite/tests/dmdanal/sigs/T21888a.stderr
=====================================
@@ -7,7 +7,7 @@ T21888a.wombat: <S!P(S)>b
==================== Cpr signatures ====================
-T21888a.f: 2
+T21888a.f:
T21888a.g: 1
T21888a.wombat: b
=====================================
testsuite/tests/printer/T18052a.stderr
=====================================
@@ -10,11 +10,11 @@ Dependent packages: [(normal, base-4.23.0.0)]
==================== Tidy Core ====================
Result size of Tidy Core
- = {terms: 24, types: 52, coercions: 0, joins: 0/0}
+ = {terms: 18, types: 46, coercions: 0, joins: 0/0}
--- RHS size: {terms: 7, types: 6, coercions: 0, joins: 0/0}
+-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
T18052a.$b:||: :: forall {a} {b}. a -> b -> (a, b)
-T18052a.$b:||: = \ (@a) (@b) (x :: a) (y :: b) -> (x, y)
+T18052a.$b:||: = GHC.Internal.Tuple.(,)
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
(+++) :: forall {a}. [a] -> [a] -> [a]
=====================================
testsuite/tests/simplCore/should_compile/T24726.stderr
=====================================
@@ -1,5 +1,5 @@
-==================== Rule check ====================
+------ Rule check ------
Rule check results:
--------------------
Expression: concatMapS @(*) @Int @Int foo1
@@ -8,7 +8,7 @@ Rule "concatMap": all arguments match (considered individually), but rule as a w
-==================== Rule check ====================
+------ Rule check ------
Rule check results:
--------------------
Expression: concatMapS @(*) @Int @Int foo1
@@ -17,7 +17,7 @@ Rule "concatMap": all arguments match (considered individually), but rule as a w
-==================== Rule check ====================
+------ Rule check ------
Rule check results:
--------------------
Expression: concatMapS @(*) @Int @Int foo1
@@ -26,7 +26,7 @@ Rule "concatMap": all arguments match (considered individually), but rule as a w
-==================== Rule check ====================
+------ Rule check ------
Rule check results:
--------------------
Expression: concatMapS @(*) @Int @Int foo1
=====================================
testsuite/tests/simplCore/should_compile/T27212.hs
=====================================
@@ -0,0 +1,18 @@
+{-# OPTIONS_GHC -Wno-inaccessible-code -Wno-overlapping-patterns #-}
+module T27212 where
+
+import Unsafe.Coerce
+
+class Given a where given :: a
+newtype Gift a r = Gift (Given a => r)
+
+useIt :: Given Int => Int
+useIt = given + 1
+{-# NOINLINE useIt #-}
+
+foo :: [Int] -> [Int]
+foo xs = case unsafeEqualityProof @(Gift Int Int) @(Int -> Int) of
+ UnsafeRefl -> map (\y -> (Gift useIt :: Gift Int Int) y) xs
+ -- That (\y. glah y) can eta-reduce to `glah`
+ -- but doing so makes a FunCo coercion that crosses from
+ -- Type to constraint. Tricky.
=====================================
testsuite/tests/simplCore/should_compile/all.T
=====================================
@@ -631,3 +631,4 @@ test('T27936', normal, compile, [''])
test('T27910', grep_errmsg(r'KnownBranch'), compile, ['-O -dno-typeable-binds -ddump-simpl-stats -dsuppress-uniques'])
test('T27892', grep_errmsg(r'^f = g$'), compile, ['-O -ddump-cse -dsuppress-all -dsuppress-uniques'])
test('T28095a', grep_errmsg(r'^f = g$'), compile, ['-O -ddump-cse -dsuppress-all -dsuppress-uniques'])
+test('T27212', normal, compile, ['-O'])
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/46235ab57884e30dfd46d79544a0b6…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/46235ab57884e30dfd46d79544a0b6…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/jeltsch/file-and-dir-cache-with-fast-string-keys] 3 commits: rts: Fix unwinding information for StgRun
by Wolfgang Jeltsch (@jeltsch) 24 Nov '26
by Wolfgang Jeltsch (@jeltsch) 24 Nov '26
24 Nov '26
Wolfgang Jeltsch pushed to branch wip/jeltsch/file-and-dir-cache-with-fast-string-keys at Glasgow Haskell Compiler / GHC
Commits:
1340d255 by ARATA Mizuki at 2026-11-23T20:13:03-05:00
rts: Fix unwinding information for StgRun
The unwinding rule for rsp updated in a5ec467ee3d4e77c026437a545981269acde3434
was wrong. It gave the value of rsp _after_ the call instruction (i.e.
on entry to StgRun), whereas it should give the value _before_ the call
instruction (i.e. the caller's rsp).
Fixes #27637
- - - - -
56bb91d9 by Alan Zimmerman at 2026-11-23T20:13:44-05:00
EPA: Replace AnnListLayout / AnnListBrackets with EpLayout
We have harmonised the use of `AnnListLayout` and `AnnListBrackets` to
be equivalent to `EpLayout`.
We now take the final step, and remove them completely in favour of
`EpLayout`.
The change looks bigger than it is, because a lot of golden test
output gets updated.
- - - - -
771c0746 by Wolfgang Jeltsch at 2026-11-25T00:15:54+02:00
Switch file and directory cache to `FastString` keys
Resolves #28139.
- - - - -
34 changed files:
- + changelog.d/T27637
- compiler/GHC/HsToCore/Usage.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Unit/Finder.hs
- compiler/GHC/Unit/Finder/Types.hs
- rts/StgCRun.c
- testsuite/tests/ghc-api/exactprint/T22919.stderr
- testsuite/tests/ghc-api/exactprint/Test20239.stderr
- testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr
- testsuite/tests/module/mod185.stderr
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/DumpSemis.stderr
- testsuite/tests/parser/should_compile/KindSigs.stderr
- testsuite/tests/parser/should_compile/T14189.stderr
- testsuite/tests/parser/should_compile/T15279.stderr
- testsuite/tests/parser/should_compile/T15323.stderr
- testsuite/tests/parser/should_compile/T20452.stderr
- testsuite/tests/parser/should_compile/T20718.stderr
- testsuite/tests/parser/should_compile/T20846.stderr
- testsuite/tests/printer/T18791.stderr
- testsuite/tests/printer/Test20297.stdout
- testsuite/tests/printer/Test24533.stdout
- utils/check-exact/ExactPrint.hs
- utils/check-exact/Main.hs
- utils/check-exact/Transform.hs
- utils/check-exact/Utils.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d71894eb719ad89318e5b8645d65e3…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d71894eb719ad89318e5b8645d65e3…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/jeltsch/file-and-dir-cache-with-fast-string-keys] Switch from `UniqMap FastString` to `FastStringEnv`
by Wolfgang Jeltsch (@jeltsch) 24 Nov '26
by Wolfgang Jeltsch (@jeltsch) 24 Nov '26
24 Nov '26
Wolfgang Jeltsch pushed to branch wip/jeltsch/file-and-dir-cache-with-fast-string-keys at Glasgow Haskell Compiler / GHC
Commits:
d71894eb by Wolfgang Jeltsch at 2026-11-25T00:13:25+02:00
Switch from `UniqMap FastString` to `FastStringEnv`
- - - - -
1 changed file:
- compiler/GHC/Unit/Finder.hs
Changes:
=====================================
compiler/GHC/Unit/Finder.hs
=====================================
@@ -56,6 +56,7 @@ import GHC.Data.IOEnv (IOEnv, runIOEnv, getEnv)
import GHC.Data.OsPath
import qualified GHC.Data.ShortText as ST
import GHC.Data.FastString (FastString, unpackFS)
+import GHC.Data.FastString.Env (emptyFsEnv, lookupFsEnv, extendFsEnv)
import GHC.Driver.Env
import GHC.Driver.Config.Finder
@@ -122,30 +123,30 @@ type BaseName = OsPath -- Basename of file
initFinderCache :: IO FinderCache
initFinderCache = do
home_cache <- newHomeFinderCache
- file_cache <- newIORef emptyUniqMap
- dir_cache <- newIORef emptyUniqMap
+ file_cache <- newIORef emptyFsEnv
+ dir_cache <- newIORef emptyFsEnv
let flushFinderCaches :: IO ()
flushFinderCaches = do
clearHomeFinderCache home_cache
- atomicModifyIORef' file_cache $ \_ -> (emptyUniqMap, ())
- atomicModifyIORef' dir_cache $ \_ -> (emptyUniqMap, ())
+ atomicModifyIORef' file_cache $ \_ -> (emptyFsEnv, ())
+ atomicModifyIORef' dir_cache $ \_ -> (emptyFsEnv, ())
lookupFileCache :: FastString -> IO Fingerprint
lookupFileCache key = do
c <- readIORef file_cache
- case lookupUniqMap c key of
+ case lookupFsEnv c key of
Nothing -> do
hash <- getFileHash (unpackFS key)
- atomicModifyIORef' file_cache $ \c -> (addToUniqMap c key hash, ())
+ atomicModifyIORef' file_cache $ \c -> (extendFsEnv c key hash, ())
return hash
Just fp -> return fp
lookupDirCache :: FastString -> IO Fingerprint
lookupDirCache key = do
c <- readIORef dir_cache
- case lookupUniqMap c key of
+ case lookupFsEnv c key of
Nothing -> do
hash <- getDirHash (unpackFS key)
- atomicModifyIORef' dir_cache $ \c -> (addToUniqMap c key hash, ())
+ atomicModifyIORef' dir_cache $ \c -> (extendFsEnv c key hash, ())
return hash
Just fp -> return fp
return $
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d71894eb719ad89318e5b8645d65e34…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d71894eb719ad89318e5b8645d65e34…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/jeltsch/file-and-dir-cache-with-fast-string-keys] Move `GHC.Data.FastString` import into appropriate section
by Wolfgang Jeltsch (@jeltsch) 24 Nov '26
by Wolfgang Jeltsch (@jeltsch) 24 Nov '26
24 Nov '26
Wolfgang Jeltsch pushed to branch wip/jeltsch/file-and-dir-cache-with-fast-string-keys at Glasgow Haskell Compiler / GHC
Commits:
f28974a4 by Wolfgang Jeltsch at 2026-11-25T00:01:05+02:00
Move `GHC.Data.FastString` import into appropriate section
- - - - -
1 changed file:
- compiler/GHC/Unit/Finder.hs
Changes:
=====================================
compiler/GHC/Unit/Finder.hs
=====================================
@@ -55,6 +55,7 @@ import GHC.Platform.Ways
import GHC.Data.IOEnv (IOEnv, runIOEnv, getEnv)
import GHC.Data.OsPath
import qualified GHC.Data.ShortText as ST
+import GHC.Data.FastString (FastString, unpackFS)
import GHC.Driver.Env
import GHC.Driver.Config.Finder
@@ -86,8 +87,6 @@ import GHC.Types.Unique.Map
import GHC.Types.Unique.Set
import GHC.Types.UnresolvedImport
-import GHC.Data.FastString (FastString, unpackFS)
-
import Control.Applicative ((<|>))
import Control.Exception (throwIO)
import Control.Monad
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f28974a4f89fc8d77449fb1c4b4f5c9…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f28974a4f89fc8d77449fb1c4b4f5c9…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/io-manager-deadlock-detection] 2 commits: Add tests for deadlock detection, issue #26408
by Duncan Coutts (@dcoutts) 24 Nov '26
by Duncan Coutts (@dcoutts) 24 Nov '26
24 Nov '26
Duncan Coutts pushed to branch wip/io-manager-deadlock-detection at Glasgow Haskell Compiler / GHC
Commits:
49fe2278 by Duncan Coutts at 2026-11-24T21:26:33+00:00
Add tests for deadlock detection, issue #26408
We have three tests:
T26408a: make sure that we can detect a /partial deadlock/ that is not
also a /system deadlock/
T26408b: make sure that we can detect a /system deadlock/ promptly
without relying on idle GC
T26408c: make sure that we do not falsely detect a deadlock when there is
nothing to do except wait on signals
T26408d: make sure that we can detect a system deadlock with idle GC
disabled, after the idle GC timeout has elapsed.
T26408e: test that performDeadlockDetection works
- - - - -
f8e9fb69 by Duncan Coutts at 2026-11-24T21:26:33+00:00
Update the user guide with the revised idle GC behaviour
It's now not just for the threaded RTS, but general.
Add a new section in the RTS chapter: Idle GC and deadlock detection.
Provide general documentation on both topics. In particular, document
the behaviour of deadlock detection and how it depends on idle GC.
Move the existing entries for -I and -Iw to this section.
Add a changelog entry.
- - - - -
15 changed files:
- + changelog.d/idle-gc-and-deadlock-detection
- docs/users_guide/profiling.rst
- docs/users_guide/runtime_control.rst
- testsuite/tests/rts/Makefile
- + testsuite/tests/rts/T26408a.hs
- + testsuite/tests/rts/T26408a.stderr
- + testsuite/tests/rts/T26408b.hs
- + testsuite/tests/rts/T26408b.stderr
- + testsuite/tests/rts/T26408c.hs
- + testsuite/tests/rts/T26408c.stdout
- + testsuite/tests/rts/T26408d.hs
- + testsuite/tests/rts/T26408d.stderr
- + testsuite/tests/rts/T26408e.hs
- + testsuite/tests/rts/T26408e.stderr
- testsuite/tests/rts/all.T
Changes:
=====================================
changelog.d/idle-gc-and-deadlock-detection
=====================================
@@ -0,0 +1,22 @@
+section: rts
+issues: #27040 #26408
+mrs: !14820
+synopsis: Idle GC and deadlock detection in the non-threaded RTS now behave the same as in the threaded RTS
+description: {
+Idle GC now works in the non-threaded RTS and is enabled by default.
+
+Deadlock detection in the non-threaded RTS now follows the same design and
+behaviour as in the threaded RTS. In particular, it can detect partial
+deadlocks where some but not all threads are deadlocked. The detection is no
+longer prompt however, as the detection runs as part of idle GC, which (by
+default) is performed 0.3 seconds after all capabilities become idle.
+
+The user guide now documents that deadlock detection relies on idle GC,
+and thus turning off idle GC disables deadlock detection. This is true
+of the threaded RTS in previous GHC releases but it was not previously
+documented behaviour.
+
+Internally, the idle GC and deadlock detection now follow the same design and
+use 99% the same code between the non-threaded and threaded RTS. Having a
+single design improves the comprehension and maintainability of the RTS code.
+}
=====================================
docs/users_guide/profiling.rst
=====================================
@@ -655,11 +655,13 @@ enclosed between ``+RTS ... -RTS`` as usual):
order to increase the resolution of the time profiler.
Using a value of zero disables the RTS clock completely, and has the
- effect of disabling timers that depend on it: the context switch
- timer and the heap profiling timer. Context switches will still
- happen, but deterministically and at a rate much faster than normal.
- Disabling the interval timer is useful for debugging, because it
- eliminates a source of non-determinism at runtime.
+ effect of disabling the timers and features that depend on it: the context
+ switch timer, the heap profiling timer, the eventlog flush timer, and the
+ idle GC timer. Context switches will still happen, but deterministically
+ and at a rate much faster than normal. Disabling the interval timer is
+ useful for debugging, because it eliminates a source of non-determinism at
+ runtime. Note however that disabling the idle GC timer not only disables
+ idle GC but also deadlock detection (see rts-flag:`-I`).
.. rts-flag:: -xc
=====================================
docs/users_guide/runtime_control.rst
=====================================
@@ -735,61 +735,6 @@ performance.
``-H0`` resets both the size suggestion, and dynamic scaling enablied by a
bare ``-H``.
-.. rts-flag:: -I ⟨seconds⟩
-
- :default: 0.3 seconds in the threaded runtime, 0 in the non-threaded runtime
-
- .. index::
- single: idle GC
-
- Set the amount of idle time which must pass before a idle GC is
- performed. Setting ``-I0`` disables the idle GC.
-
- In the threaded and SMP versions of the RTS (see :ghc-flag:`-threaded`,
- :ref:`options-linker`), a major GC is automatically performed if the
- runtime has been idle (no Haskell computation has been running) for a
- period of time.
-
- For an interactive application, it is probably a good idea to use
- the idle GC, because this will allow finalizers to run and
- deadlocked threads to be detected in the idle time when no Haskell
- computation is happening. Also, it will mean that a GC is less
- likely to happen when the application is busy, and so responsiveness
- may be improved. However, if the amount of live data in the heap is
- particularly large, then the idle GC can cause a significant delay,
- and too small an interval could adversely affect interactive
- responsiveness.
-
- The idle period timer only resets after some activity
- by a Haskell thread. If your program is doing literally nothing then
- after the first idle collection is triggered then no more future collections
- will be scheduled until more work is performed.
-
- This is an experimental feature, please let us know if it causes
- problems and/or could benefit from further tuning.
-
-.. rts-flag:: -Iw ⟨seconds⟩
-
- :default: 0 seconds
-
- .. index::
- single: idle GC
-
- Set the minimum wait time between runs of the idle GC.
-
- By default, if idle GC is enabled in the threaded runtime, a major
- GC will be performed every time the process goes idle for a
- sufficiently long duration (see :rts-flag:`-I ⟨seconds⟩`). For
- large server processes accepting regular but infrequent requests
- (e.g., once per second), an expensive, major GC may run after
- every request. As an alternative to shutting off idle GC entirely
- (with ``-I0``), a minimum wait time between idle GCs can be
- specified with this flag. For example, ``-Iw60`` will ensure that
- an idle GC runs at most once per minute.
-
- This is an experimental feature, please let us know if it causes
- problems and/or could benefit from further tuning.
-
.. rts-flag:: -ki ⟨size⟩
:default: 1k
@@ -1015,6 +960,118 @@ performance.
``GHC.Stats.getRTSStats`` from Haskell.
+Idle GC and deadlock detection
+------------------------------
+
+The RTS performs idle GC and deadlock detection. These features are more
+closely related and dependent than one might expect. In particular, deadlock
+detection relies on idle GC.
+
+The primary purpose of idle GC is to reclaim memory and return it to the system
+when the application has been idle for a short time. It also gives an
+opportunity for finalisers to run more promptly. See :rts-flag:`-I ⟨seconds⟩`.
+
+Deadlock detection is a debugging feature to try to discover when some or all
+Haskell threads are deadlocked. For the purpose of this explanation we define:
+
+ * a "partial deadlock" to be a set of threads that are deadlocked; and
+ * a "system deadlock" is when all threads are deadlocked.
+
+The deadlock detection is implemented by the GC, and it is capable of detecting
+partial deadlocks. If a deadlock is discovered, the RTS will throw an
+asynchronous exception to (some or all of) the blocked threads to enable
+progress and enable better reporting of the problem. In particular it throws
+the async exceptions ``BlockedIndefinitelyOnMVar`` or
+``BlockedIndefinitelyOnSTM``, as appropriate.
+
+The deadlock detection can be run during a major GC, but it is more expensive
+than a normal major GC so it is not run during normal major GCs. The deadlock
+detection mode of GC is run by the idle GC. This is on the basis that when the
+application is idle is when we are most likely to find a deadlock, and also
+that the extra time cost is unlikely to be a problem because the application is
+already idle.
+
+There are a few consequence of this:
+
+ * Deadlock detection relies on idle GC and will not run if idle GC is disabled
+ with ``-I0``.
+ * Deadlock detection will not run if the application remains busy, and thus
+ idle GC is not invoked.
+ * Deadlock detection is not prompt: it will only occur after the idle GC
+ delay, depending on both :rts-flag:`-I ⟨seconds⟩` and
+ :rts-flag:`-Iw ⟨seconds⟩`.
+
+In the non-threaded RTS there is additional behaviour: system deadlocks will be
+detected promptly, and this works even if idle GC is otherwise disabled.
+(This is not supported by the WinIO I/O manager however, see GHC issue #28057).
+
+One cannot rely on deadlock detection as part of the normal program behaviour.
+It should only be used for debugging. Firstly, deadlock detection can be
+disabled or indefinately deferred due to activity. Secondly, the set of threads
+that deadlock detection throws exceptions to is not minimal: a thread waiting
+on a deadlocked thread is also considered deadlocked and will have an exception
+thrown to it even if it could make progress after the deadlocked thread is
+terminated.
+
+Deadlock detection can be invoked manually using ``performDeadlockDetection``
+from ``System.Mem.Experimental``.
+
+
+.. rts-flag:: -I ⟨seconds⟩
+
+ :default: 0.3 seconds
+
+ .. index::
+ single: idle GC
+
+ A major GC is automatically performed if the runtime has been idle (no
+ Haskell computation has been running) for a period of time. Set the amount
+ of idle time which must pass before a idle GC is performed.
+
+ Setting ``-I0`` disables the idle GC. This also has the unfortunate side
+ effect of disabling thread deadlock detection (the implementation of which
+ uses the idle GC).
+
+ For an interactive application, it is probably a good idea to use
+ the idle GC, because this will allow finalizers to run and
+ deadlocked threads to be detected in the idle time when no Haskell
+ computation is happening. Also, it will mean that a GC is less
+ likely to happen when the application is busy, and so responsiveness
+ may be improved. However, if the amount of live data in the heap is
+ particularly large, then the idle GC can cause a significant delay,
+ and too small an interval could adversely affect interactive
+ responsiveness.
+
+ The idle period timer only resets after some activity
+ by a Haskell thread. If your program is doing literally nothing then
+ after the first idle collection is triggered then no more future collections
+ will be scheduled until more work is performed.
+
+ Please let us know if it causes problems and/or could benefit from further
+ tuning.
+
+.. rts-flag:: -Iw ⟨seconds⟩
+
+ :default: 0 seconds
+
+ .. index::
+ single: idle GC
+
+ Set the minimum wait time between runs of the idle GC.
+
+ By default (and if idle GC is not disabled) a major
+ GC will be performed every time the process goes idle for a
+ sufficiently long duration (see :rts-flag:`-I ⟨seconds⟩`). For
+ large server processes accepting regular but infrequent requests
+ (e.g., once per second), an expensive, major GC may run after
+ every request. As an alternative to shutting off idle GC entirely
+ (with ``-I0``), a minimum wait time between idle GCs can be
+ specified with this flag. For example, ``-Iw60`` will ensure that
+ an idle GC runs at most once per minute.
+
+ This is an experimental feature, please let us know if it causes
+ problems and/or could benefit from further tuning.
+
.. _rts-options-statistics:
=====================================
testsuite/tests/rts/Makefile
=====================================
@@ -163,3 +163,11 @@ census_pinned:
'$(TEST_HC)' $(TEST_HC_OPTS) -O -rtsopts -v0 census_pinned.hs -o census_pinned
./census_pinned +RTS -hT -i0 -RTS
grep -m1 '^ARR_WORDS' census_pinned.hp
+
+.PHONY: T26408c
+T26408c:
+ "$(TEST_HC)" $(TEST_HC_OPTS) -rtsopts T26408c.hs; \
+ ./T26408c +RTS -I0 -T & \
+ sleep 1; \
+ kill -s USR1 $$!; \
+ wait $$!
=====================================
testsuite/tests/rts/T26408a.hs
=====================================
@@ -0,0 +1,54 @@
+import Control.Concurrent
+import Control.Concurrent.STM
+import Control.Exception
+import Control.Monad
+
+-- | Test to make sure that we can detect a /partial deadlock/ that is /not/
+-- also a /system deadlock/: that is we can detect a set of deadlocked threads
+-- even when there are other unrelated threads that are waiting on I\/O or
+-- timeouts.
+--
+-- Historically this did not work in the non-threaded RTS which would only do
+-- deadlock detection if there was a system deadlock: no runnable threads /and/
+-- no pending I\/O or timers.
+--
+-- See Note [Deadlock detection]
+--
+main :: IO ()
+main = do
+
+ -- Set up two threads that are deadlocked on each other
+ aDone <- newTVarIO False
+ bDone <- newTVarIO False
+ let blockingThread theirDone ourDone =
+ atomically $ do
+ done <- readTVar theirDone
+ guard done
+ writeTVar ourDone True
+ _ <- forkIO (blockingThread bDone aDone)
+ _ <- forkIO (blockingThread aDone bDone)
+
+ -- Set up another thread that is blocked on a long timeout.
+ --
+ -- We use a timeout rather than I/O as it's more portable, whereas I/O waits
+ -- are different between posix and windows I/O managers.
+ --
+ -- One gotcha is that when the timeout completes then the deadlock will be
+ -- detected again (since the bug is about I/O or timeouts masking deadlock
+ -- detection). So for a reliable test the timeout used here must be longer
+ -- than the test framework's own timeout. So we use maxBound, and we adjust
+ -- the test framework's timeout to be short (see run_timeout_multiplier).
+ _ <- forkIO (threadDelay maxBound)
+
+ -- Wait on the two deadlocked threads to terminate. This is now a partial
+ -- deadlock but not a system deadlock (the main thread and the first two
+ -- threads are deadlocked, but the one waiting on the timeout is ok).
+ --
+ -- We now expect that the threads that are deadlocked are detected as such
+ -- and an exception is thrown to some or all of them.
+ --
+ -- Note that if this fails, the test itself will effectively deadlock and
+ -- will rely on the test framework's timeout.
+ atomically $ do
+ status <- mapM readTVar [aDone, bDone]
+ guard (or status)
=====================================
testsuite/tests/rts/T26408a.stderr
=====================================
@@ -0,0 +1,3 @@
+T26408a: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.BlockedIndefinitelyOnSTM:
+
+thread blocked indefinitely in an STM transaction
=====================================
testsuite/tests/rts/T26408b.hs
=====================================
@@ -0,0 +1,41 @@
+import Control.Concurrent
+import Control.Concurrent.STM
+import Control.Exception
+import Control.Monad
+
+-- | Test to make sure that we can detect a /system deadlock/ promptly which
+-- means without relying on idle GC. To check this we have to turn off idle GC,
+-- (+RTS -I0) which is what normally triggers deadlock detection.
+--
+-- This is only expected to work in the non-threaded RTS. In principle this
+-- test could also work with the threaded RTS when using only a single
+-- capability, if the I\/O managers can support it. Currently that is not the
+-- case.
+--
+-- See Note [Deadlock detection]
+--
+main :: IO ()
+main = do
+
+ -- Set up two threads that are deadlocked on each other
+ aDone <- newTVarIO False
+ bDone <- newTVarIO False
+ let blockingThread theirDone ourDone =
+ atomically $ do
+ done <- readTVar theirDone
+ guard done
+ writeTVar ourDone True
+ _ <- forkIO (blockingThread bDone aDone)
+ _ <- forkIO (blockingThread aDone bDone)
+
+ -- Wait on the two deadlocked threads to terminate. This is now a system
+ -- deadlock, involving all three threads (the main thread and the other two).
+ --
+ -- We now expect that the threads that are deadlocked are detected as such
+ -- and an exception is thrown to some or all of them.
+ --
+ -- Note that if this fails, the test itself will effectively deadlock and
+ -- will rely on the test framework's timeout.
+ atomically $ do
+ status <- mapM readTVar [aDone, bDone]
+ guard (or status)
=====================================
testsuite/tests/rts/T26408b.stderr
=====================================
@@ -0,0 +1,3 @@
+T26408b: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.BlockedIndefinitelyOnSTM:
+
+thread blocked indefinitely in an STM transaction
=====================================
testsuite/tests/rts/T26408c.hs
=====================================
@@ -0,0 +1,61 @@
+import Control.Concurrent
+import Control.Concurrent.STM
+import Control.Exception
+import Control.Monad
+
+import System.Posix.Signals
+import GHC.Stats.Experimental
+
+-- | Test to make sure that we do not falsely detect a deadlock when there is
+-- nothing to do except wait on signals. This is to make sure that our prompt
+-- system deadlock detection is not too eager.
+--
+-- We arrange a partial deadlock that can be broken if a signal arrives and
+-- the signal handler can unblock things.
+--
+-- This should /not/ result in any deadlock being detected, and no other odd
+-- behaviour, like getting caught in a loop and doing too many idle GCs. So we
+-- count and report the number of major GCs.
+--
+main :: IO ()
+main = do
+
+ -- Set up two threads that are deadlocked on each other
+ aDone <- newTVarIO False
+ bDone <- newTVarIO False
+ let blockingThread theirDone ourDone =
+ atomically $ do
+ done <- readTVar theirDone
+ guard done
+ writeTVar ourDone True
+
+ installHandler userDefinedSignal1
+ (Catch $ do
+ atomically $ writeTVar aDone True
+ >> writeTVar bDone True
+ putStrLn "caught SIGUSR1")
+ Nothing
+
+ _ <- forkIO (blockingThread bDone aDone)
+ _ <- forkIO (blockingThread aDone bDone)
+ yield
+
+ -- Wait on the deadlocked threads to terminate. We now expect that the threads
+ -- that are deadlocked are detected as such and an exception is raised.
+ -- Note that if this fails, the test itself will effectively deadlock and
+ -- will rely on the test framework's timeout.
+ putStrLn "waiting on deadlocked threads..."
+ atomically $ do
+ status <- mapM readTVar [aDone, bDone]
+ guard (or status)
+
+ -- We expect exactly 1 major GC: the one triggered for deadlock detection
+ -- where we find no deadlock. We should then sleep without doing more GC.
+ -- An easy mistake would be looping: detecting probable deadlock, do idle GC.
+ -- See notifyIdleGcDeadlock().
+ stats <- getRTSStats
+ putStrLn ("terminated normally, major GCs = " ++ show (major_gcs stats))
+ -- This test _could_ be sensitive to changes in default heap sizes etc. If
+ -- this number ends up as 2 for example, then adjust the RTS opts (in the
+ -- makefile) so that the heap is big enough that normally no major GC would
+ -- be needed.
=====================================
testsuite/tests/rts/T26408c.stdout
=====================================
@@ -0,0 +1,5 @@
+[1 of 2] Compiling Main ( T26408c.hs, T26408c.o )
+[2 of 2] Linking T26408c
+waiting on deadlocked threads...
+caught SIGUSR1
+terminated normally, major GCs = 1
=====================================
testsuite/tests/rts/T26408d.hs
=====================================
@@ -0,0 +1,15 @@
+import Control.Concurrent
+import Foreign.C
+
+-- | Test to make sure that we detect a system deadlock even when idle GC is
+-- disabled and the system has been idle long enough for the timer tick to be
+-- turned off.
+
+main :: IO ()
+main = do
+ m <- newEmptyMVar
+ _ <- c_sleep 1 -- longer than the 300ms idle GC timeout
+ takeMVar m -- should detect system deadlock here
+
+foreign import ccall unsafe "unistd.h sleep" c_sleep :: CUInt -> IO CUInt
+
=====================================
testsuite/tests/rts/T26408d.stderr
=====================================
@@ -0,0 +1,3 @@
+T26408d: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.BlockedIndefinitelyOnMVar:
+
+thread blocked indefinitely in an MVar operation
=====================================
testsuite/tests/rts/T26408e.hs
=====================================
@@ -0,0 +1,49 @@
+import Control.Concurrent
+import Control.Concurrent.STM
+import Control.Exception
+import Control.Monad
+import System.Mem.Experimental (performDeadlockDetection)
+
+-- | Test to make sure that we can detect a partial deadlock when idle GC is
+-- turned off, and we manually invoke performDeadlockDetection.
+--
+main :: IO ()
+main = do
+
+ -- Set up two threads that are deadlocked on each other
+ aDone <- newTVarIO False
+ bDone <- newTVarIO False
+ let blockingThread theirDone ourDone =
+ atomically $ do
+ done <- readTVar theirDone
+ guard done
+ writeTVar ourDone True
+ _ <- forkIO (blockingThread bDone aDone)
+ _ <- forkIO (blockingThread aDone bDone)
+
+ -- Arrange for another thread to wait a bit (longer than the default 300ms
+ -- idle GC timeout, just to be sure) and then manually invoke deadlock
+ -- detection.
+ _ <- forkIO (threadDelay 500_000 >> performDeadlockDetection)
+
+ -- And another thread to ensure that we don't have a system deadlock once
+ -- the thread above terminates. Otheriwse we might get false test passes
+ -- even if performDeadlockDetection were a no-op because when the thread
+ -- above terminates then (if not for this one) all threads would be
+ -- deadlocked, and system deadlock detection would kick in and detect the
+ -- deadlock instead (defeating the point of the test).
+ _ <- forkIO (threadDelay maxBound)
+
+ -- Wait on the two deadlocked threads to terminate. This is now a partial
+ -- deadlock but not a system deadlock (the main thread and the first two
+ -- threads are deadlocked, but the one waiting on the timeout is ok).
+ --
+ -- When the manually invoked deadlock detection runs (above) we expect that
+ -- the threads that are deadlocked are detected as such, and that an
+ -- exception will be thrown to all of them.
+ --
+ -- Note that if this fails, the test itself will effectively deadlock and
+ -- will rely on the test framework's timeout.
+ atomically $ do
+ status <- mapM readTVar [aDone, bDone]
+ guard (or status)
=====================================
testsuite/tests/rts/T26408e.stderr
=====================================
@@ -0,0 +1,3 @@
+T26408e: Uncaught exception ghc-internal:GHC.Internal.IO.Exception.BlockedIndefinitelyOnSTM:
+
+thread blocked indefinitely in an STM transaction
=====================================
testsuite/tests/rts/all.T
=====================================
@@ -701,6 +701,35 @@ test('T22859',
omit_ways(llvm_ways + ['nonmoving_thr', 'nonmoving_thr_sanity'])],
compile_and_run, ['-with-rtsopts -A8K'])
+# Deadlock detection testsL
+# A: check we can detect a partial deadlock that is not a system deadlock
+test('T26408a', [exit_code(1), run_timeout_multiplier(0.1)], compile_and_run, [''])
+# B: check we can detect system deadlock with idle GC turned off (+RTS -I0)
+test('T26408b', [all_available_io_managers_except(['winio', 'mio']),
+ omit_ways(['threaded2']),
+ extra_run_opts('+RTS -I0 -RTS'),
+ exit_code(1), run_timeout_multiplier(0.1)],
+ compile_and_run, ['-rtsopts'])
+# C: check we do not falsely detect deadlock when blocked only on signals
+# Skip for win32, wasm and js since this test requires posix signals
+test('T26408c', [when(opsys('mingw32'), skip),
+ when(arch('wasm32'), skip), js_skip,
+ run_timeout_multiplier(0.1)],
+ makefile_test, ['T26408c'])
+# D: check we do detect deadlock with idle GC off and a long pause
+test('T26408d', [all_available_io_managers_except(['winio', 'mio']),
+ js_skip, omit_ways(['threaded2']),
+ extra_run_opts('+RTS -I0 -RTS'),
+ exit_code(1), run_timeout_multiplier(0.1)],
+ compile_and_run, ['-rtsopts'])
+# E: test manual performDeadlockDetection
+test('T26408e', [extra_run_opts('+RTS -I0 -RTS'),
+ exit_code(1), run_timeout_multiplier(0.1)],
+ compile_and_run, ['-rtsopts'])
+# TODO: test with I/O managers for threaded ways with +RTS -N1,
+# but it will be broken for now.
+
+
# These tests need access to the internal RTS headers.
# TODO: there is probably some cleaner way to do this, and it should probably
# be guarded for in-tree tests, since it cannot work against an arbitrary
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8112e5f94f59d9ef855920b7fcbb6a…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/8112e5f94f59d9ef855920b7fcbb6a…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0
[Git][ghc/ghc][wip/az/exactprint-annotation-rationalisation] 58 commits: NCG: List each destination of a jump table once
by Alan Zimmerman (@alanz) 24 Nov '26
by Alan Zimmerman (@alanz) 24 Nov '26
24 Nov '26
Alan Zimmerman pushed to branch wip/az/exactprint-annotation-rationalisation at Glasgow Haskell Compiler / GHC
Commits:
01a5b0ac by Sylvain Henry at 2026-11-22T16:35:34-05:00
NCG: List each destination of a jump table once
jumpDestsOfInstr listed a block once per jump table entry that named
it. The linear register allocator makes a fixup block per listed
destination, so such a block got several fixup blocks. The patch of
the jump sends every entry to the first one. The other fixup blocks
were dead code, and the CFG had an edge to each of them.
jumpDestsOfInstr now lists each destination once, in every backend.
joinToTargets asserts it in debug builds.
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
e4498112 by Andreas Klebinger at 2026-11-22T16:35:34-05:00
x86 ncg: Track the current block in NatM to keep the CFG in sync
The x86 NCG uses a CFG for code layout. When instruction selection
makes new blocks (word2Float#, cmpxchg loops, 64-bit shifts on i386),
it must add them to the CFG. Some sites did not. The CFG went out of
sync, the layout was bad, and the register allocator panicked when it
added fixup blocks (#27694, #27915).
NatM now keeps the current block in its state. Combinators update the
CFG and the current block together. See Note [Updating the CFG during
CodeGen] in GHC.CmmToAsm.Monad.
Other changes:
* -dasm-lint checks that the jumps in the code and the edges in the
CFG agree in both directions. This found a second desync: the CFG
did not follow the jumps that allocMoreStack retargets. The new
addPreentryBlock fixes it.
* The code must be emitted in generation order, because the CFG
records new blocks in that order. A store now generates the code of
its value before the code of its address, in the order it emits
them. Atomic operations take their address from the new
getNonClobberedAmode, so the code of their other operands cannot
clobber it.
Fixes #27694, #27915
Co-authored-by: Sylvain Henry <sylvain(a)haskus.fr>
Co-Authored-By: Claude Fable 5.1 <noreply(a)anthropic.com>
- - - - -
f59fb957 by Sylvain Henry at 2026-11-22T16:35:34-05:00
x86 ncg: Maintain the CFG on i386
The i386 NCG now keeps its CFG in sync with the code (see the previous
commit), so backendMaintainsCfg is now True for i386. i386 gets the
CFG based code layout, dead code elimination and the -dasm-lint check,
like x86-64.
The compiler allocates more on i386: the CFG now goes through the
register allocator, branch shortcutting and optimizeCFG, which i386
skipped before. x86-64 already does this work.
Metric Increase:
CoOpt_Read
ManyAlternatives
T10421
T12425
T12707
T13056
T13253
T13253-spj
T13960
T15164
T15304
T15630
T15630a
T15703
T16577
T17516
T17836
T18140
T18282
T18304
T18698a
T18698b
T18730
T18923
T19695
T20049
T21839c
T24471
T26425
T26989
T5642
T6048
T783
T9233
T9630
Co-Authored-By: Claude Opus 5.5 <noreply(a)anthropic.com>
- - - - -
2091b89a by fendor at 2026-11-22T16:36:17-05:00
`ghc -M`: Add support for link nodes to json output
`LinkNode`s are part of the module graph and indicate that a certain
linking artefact is to be produced from other module graph nodes.
We expose `LinkNode`s in the output of `ghc -M -dep-json`, allowing
consumers to see when a linking artefact is to be produced.
Only the JSON output format of `ghc -M` supports `LinkNode` as it is
unclear how the Makefile output should be retrofitted to express the
dependencies, and whether it would require a feature guard.
Closes #28007
- - - - -
cfd4fb67 by Ryan Scott at 2026-11-22T16:36:59-05:00
GHC.HsToCore.Quote: Quote \cases with the correct type
Previously, `\cases` expressions inside of Template Haskell quotes would
incorrectly use the `Match` type instead of `Clause` for the element type. We
now use `nonEmptyCoreList` when quoting `\cases`, which infers the correct type
automatically. This works because `\cases` has an invariant that the list of
clauses is always non-empty.
Fixes #27826.
- - - - -
06e71ddf by Simon Peyton Jones at 2026-11-22T16:37:40-05:00
Better desugaring for bang patterns
Ticket #27862 showed that we were desugaring bang patterns in a
silly way, which led to bad code. This small fix makes it much
better.
I ended up refactoring `decomposeFirstPat` to be of type
(LPat -> LPat) instead of (Pat -> Pat)
which made it much easier to keep the locations correct.
On the way I also fixed #28137, a missing warning.
See Note [Tidying patterns] which has new (TP1) and (TP2)
and Note [Grouping equations] especially (GE1)
- - - - -
cd6c2a96 by Simon Jakobi at 2026-11-22T16:38:23-05:00
Cmm: drop eliminated blocks from the graph in CBE
Previously, common block elimination only made the eliminated blocks
unreachable. They stayed in the graph until stack layout discarded
them.
Removing these blocks right away reduces the potential for confusion
(e.g. #27368). It does not appear to make any significant difference
to compiler allocations.
Assisted-by: Claude Opus 5.5
- - - - -
c0764c69 by Hannes Siebenhandl at 2026-11-22T16:39:04-05:00
Use Set operations over Foldable operations
Use `O(log n)` operations over `O(n)` for all call-sites of `hsc_all_home_unit_ids`.
- - - - -
242f8daf by Alan Zimmerman at 2026-11-22T16:39:46-05:00
EPA: Use AnnList in DecBrl
Via updating the TTG extension point payload
- - - - -
1e568190 by David Eichmann at 2026-11-22T16:40:28-05:00
Fix race condition in IOManager test
- - - - -
64f821c6 by Simon Peyton Jones at 2026-11-22T16:41:09-05:00
Fix a zonking bug
As #28135 showed, we were failing to zonk some type-variable
binders before doing scoped-sort dependency analysis, resulting
in chaos.
The fix is easy.
- - - - -
ed5124b3 by mangoiv at 2026-11-22T16:41:50-05:00
ci: nightly push can run on any arch
- - - - -
1340d255 by ARATA Mizuki at 2026-11-23T20:13:03-05:00
rts: Fix unwinding information for StgRun
The unwinding rule for rsp updated in a5ec467ee3d4e77c026437a545981269acde3434
was wrong. It gave the value of rsp _after_ the call instruction (i.e.
on entry to StgRun), whereas it should give the value _before_ the call
instruction (i.e. the caller's rsp).
Fixes #27637
- - - - -
56bb91d9 by Alan Zimmerman at 2026-11-23T20:13:44-05:00
EPA: Replace AnnListLayout / AnnListBrackets with EpLayout
We have harmonised the use of `AnnListLayout` and `AnnListBrackets` to
be equivalent to `EpLayout`.
We now take the final step, and remove them completely in favour of
`EpLayout`.
The change looks bigger than it is, because a lot of golden test
output gets updated.
- - - - -
72f8dc4d by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Move setLayoutBoth inside markAnnListA
The current refactoring aims to capture layout only in the `AnnList`
exact print annotation. A consequence of this is that exact printing
should only process layout when printing in the context of `AnnList`.
To achieve this, this commit moves the layout printing enabler
`setlayoutboth` into the `AnnList` processing. Future commits will
remove the other occurrences.
It also adds some tests to confirm it still works as intended, and cleans
up some other unused functions.
- - - - -
ca7db8a3 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
P:EPA: Introduce LayoutFrame stacks in ExactPrint state
- - - - -
0d22462e by Alan Zimmerman at 2026-11-24T20:22:07+00:00
P:EPA: Make EpVirtualBraces noSpanAnchor if no contents
Otherwise the vocurly is emitted at the start of the next
item parsed
Check: is this needed, or just a check for empty contents?
- - - - -
368c51e3 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
P:Align with ghc-exactprint
- - - - -
8687a250 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
P:EPA: Fix AnnList leading semis when layout
When there is layout, anything printed triggers it, including leading
semis.
Add some test case examples too
- - - - -
a525531d by Alan Zimmerman at 2026-11-24T20:22:07+00:00
MOVE EPA: Plan for Fixing AnnList Layout Properly
Also Exactprint layout scope plan
- - - - -
79043af7 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
P:Exactprint: tidy up layout capturing
- - - - -
05236d22 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
F:MD:EPA: add makeDelta test for Test20297
The original #20297 related to comment placement for exact printing
after running ExactPrint.makeDelta on ParsedSource. Add an additional
test that explicitly tests this.
- - - - -
9679e169 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Make ValBinds LocatedA in HsLocalBindsLR
If we have items with an AnnList Annotation, as part of another, which
has different content, it must be LocatedA. This is a technical requirement
due to the way comment allocation happens during the makeDelta processing.
Comments are queued for printing, and as soon as any non-comment is to
be printed, the pending comments before that position are printed, and
in makeDelta processing these attached as preceding comments to the thing
just printed.
The means they end up captured inside the layout region of the AnnList item.
So for
foo = x
where -- comment
x = 3
the comment ends up as a preceding comment of `x = 3`, inside the
layout, and prints as
foo = x
where
-- comment
x = 3
- - - - -
add5bf51 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Make IPBinds LocatedA
- - - - -
fa750262 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Make ClsInstDecl decls LocatedA
- - - - -
30bbc0f3 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
P:EPA: Make ClassDecls decls LocatedA
- - - - -
e031f506 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Make ClosedTypeFamily equations Located
For FamilyDecl/ClosedTypeFamily
- - - - -
19e0d72a by Alan Zimmerman at 2026-11-24T20:22:07+00:00
Perf ok:EPA: Make dd_cons located
- - - - -
1777d695 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Make HsMultiIf options located
- - - - -
a5c1d66f by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Make DecBrl contents LocatedA
- - - - -
e4c23f27 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Located do statements
- - - - -
6ba41852 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Print RecStmt located
- - - - -
ebeb6a82 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
P:EPA: HsCmdDo Located
- - - - -
f9da7939 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
Extend Test20297 for additional occurrences
- - - - -
51264e71 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Tweak PatSynBind location for comments
- - - - -
abda3cc2 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: WIP, add test for where ;; ValBinds
- - - - -
acbfa330 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Make EpVirtualBraces noSpanAnchor if no contents
Otherwise the vocurly is emitted at the start of the next
item parsed
Check: is this needed, or just a check for empty contents?
- - - - -
2edad0c9 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
Perf ok:EPA: Use EpNoLayout in AnnList with empty contents and no explicit braces
TODO: get rid of unused first arg to epVirtualBraces
- - - - -
fc98f693 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
Perf ok:TODO: XClassDecl: remove additional EpLayout
- - - - -
a1777a0b by Alan Zimmerman at 2026-11-24T20:22:07+00:00
Perf ok:EPA: Remove CanUpdateAnchorOnly
- - - - -
d5f5c1d3 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
Perf:decrese:EPA: Sync with ghc-exactprint after EPWriter -> CPS
- - - - -
434c449d by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Fix EpVirtualBraces for HsDo
The start of layout must include the leading semi, so we comb3 to
ensure it is included if the initial stmts are empty
- - - - -
2662ae6f by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: ClsInstDecl where clause span
- - - - -
c42e7457 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: GADT parens printing, fix
- - - - -
003687ef by Alan Zimmerman at 2026-11-24T20:22:07+00:00
Plan update DO NOT COMMIT
- - - - -
a4d41edc by Alan Zimmerman at 2026-11-24T20:22:07+00:00
F1:EPA: fix AnnList opening span for some cases
F1 as per ANNLIST-LAYOUT-FINDINGS.md
- - - - -
c031552c by Alan Zimmerman at 2026-11-24T20:22:07+00:00
F2:EPA fix vocurly start
F2
- - - - -
1f284ba0 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
F3:EPA multi way if
- - - - -
b946e65a by Alan Zimmerman at 2026-11-24T20:22:07+00:00
F4:EPA: Parse leading semis for gadt_contrs
- - - - -
14735a0c by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA:F5: Leading semicolons dropped in closed-type-family bodies
- - - - -
93c902ad by Alan Zimmerman at 2026-11-24T20:22:07+00:00
F6: ALR: skip, the feature is deprecated
- - - - -
94c63f23 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
[WIP]:F7 leading semi differences
- - - - -
62b67b58 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: First pass implementation of HsList, for ClassDecls
Just as a straight list replacement to start with, no payload.
This shows the scope and invasiveness of the initial change
- - - - -
95a567b2 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: HsList attempt WIP
- - - - -
904d88bb by Alan Zimmerman at 2026-11-24T20:22:07+00:00
Enable ppr test for Haddock1. It currently fails
- - - - -
713a3c24 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
WIP on removing NoEpAnn. Likely abandon
- - - - -
c039c837 by Alan Zimmerman at 2026-11-24T20:22:07+00:00
EPA: Add an overview doc for exact printing
- - - - -
9def32b8 by Simon Peyton Jones at 2026-11-24T20:22:07+00:00
Added an intro section
- - - - -
179 changed files:
- .gitlab-ci.yml
- + ANNLIST-LAYOUT-FINDINGS.md
- + ANNLIST-LAYOUT-PLAN.md
- + ExactPrint.md
- + LAYOUT-SCOPE-PLAN.md
- + changelog.d/27694
- + changelog.d/T27137
- + changelog.d/T27637
- + changelog.d/T27862
- + changelog.d/T28135
- + changelog.d/make-depends-link-nodes
- compiler/GHC/Cmm/CommonBlockElim.hs
- compiler/GHC/CmmToAsm.hs
- compiler/GHC/CmmToAsm/AArch64/CodeGen.hs
- compiler/GHC/CmmToAsm/AArch64/Instr.hs
- compiler/GHC/CmmToAsm/BlockLayout.hs
- compiler/GHC/CmmToAsm/CFG.hs
- compiler/GHC/CmmToAsm/Instr.hs
- compiler/GHC/CmmToAsm/LA64/Instr.hs
- compiler/GHC/CmmToAsm/Monad.hs
- compiler/GHC/CmmToAsm/PPC/Instr.hs
- compiler/GHC/CmmToAsm/RV64/Instr.hs
- compiler/GHC/CmmToAsm/Reg/Linear/JoinToTargets.hs
- compiler/GHC/CmmToAsm/X86/CodeGen.hs
- compiler/GHC/CmmToAsm/X86/Instr.hs
- compiler/GHC/Driver/Backpack.hs
- compiler/GHC/Driver/Downsweep.hs
- compiler/GHC/Driver/Main/Interactive.hs
- compiler/GHC/Driver/Make.hs
- compiler/GHC/Driver/MakeFile.hs
- compiler/GHC/Hs.hs
- compiler/GHC/Hs/Binds.hs
- compiler/GHC/Hs/Decls.hs
- compiler/GHC/Hs/DocString.hs
- compiler/GHC/Hs/Expr.hs
- compiler/GHC/Hs/ImpExp.hs
- compiler/GHC/Hs/Instances.hs
- compiler/GHC/Hs/Stats.hs
- compiler/GHC/Hs/Utils.hs
- compiler/GHC/HsToCore/Docs.hs
- compiler/GHC/HsToCore/Expr.hs
- compiler/GHC/HsToCore/Match.hs
- compiler/GHC/HsToCore/Match/Literal.hs
- compiler/GHC/HsToCore/Monad.hs
- compiler/GHC/HsToCore/Pmc.hs
- compiler/GHC/HsToCore/Pmc/Desugar.hs
- compiler/GHC/HsToCore/Quote.hs
- compiler/GHC/HsToCore/Ticks.hs
- compiler/GHC/Iface/Ext/Ast.hs
- compiler/GHC/Iface/Load.hs
- compiler/GHC/Iface/Recomp.hs
- compiler/GHC/Parser.y
- compiler/GHC/Parser/Annotation.hs
- compiler/GHC/Parser/PostProcess.hs
- compiler/GHC/Parser/PostProcess/Haddock.hs
- compiler/GHC/Rename/Bind.hs
- compiler/GHC/Rename/Expr.hs
- compiler/GHC/Rename/Module.hs
- compiler/GHC/Rename/Names.hs
- compiler/GHC/Rename/Splice.hs
- compiler/GHC/Runtime/Eval.hs
- compiler/GHC/Tc/Deriv.hs
- compiler/GHC/Tc/Gen/Bind.hs
- compiler/GHC/Tc/Gen/Expr.hs
- compiler/GHC/Tc/Gen/HsType.hs
- compiler/GHC/Tc/Module.hs
- compiler/GHC/Tc/Solver.hs
- compiler/GHC/Tc/TyCl.hs
- compiler/GHC/Tc/TyCl/Instance.hs
- compiler/GHC/Tc/Types/Origin.hs
- compiler/GHC/Tc/Utils/Env.hs
- compiler/GHC/Tc/Zonk/Type.hs
- compiler/GHC/ThToHs.hs
- compiler/Language/Haskell/Syntax.hs
- compiler/Language/Haskell/Syntax/Basic.hs
- compiler/Language/Haskell/Syntax/Binds.hs
- compiler/Language/Haskell/Syntax/Decls.hs
- compiler/Language/Haskell/Syntax/Expr.hs
- + distrib/configure.ac
- docs/users_guide/make-depends-json-schema-1_0.json
- ghc/GHCi/UI.hs
- rts/StgCRun.c
- testsuite/tests/ado/T22483.stderr
- + testsuite/tests/codeGen/should_compile/T27694.hs
- + testsuite/tests/codeGen/should_compile/T27694c.hs
- + testsuite/tests/codeGen/should_compile/T27694d.hs
- testsuite/tests/codeGen/should_compile/all.T
- + testsuite/tests/codeGen/should_run/T27694b.hs
- + testsuite/tests/codeGen/should_run/T27694b.stdout
- + testsuite/tests/codeGen/should_run/T27915.hs
- + testsuite/tests/codeGen/should_run/T27915.stdout-ws-32
- + testsuite/tests/codeGen/should_run/T27915.stdout-ws-64
- testsuite/tests/codeGen/should_run/all.T
- + testsuite/tests/deSugar/should_compile/T27862.hs
- + testsuite/tests/deSugar/should_compile/T27862.stderr
- + testsuite/tests/deSugar/should_compile/T27862a.hs
- + testsuite/tests/deSugar/should_compile/T27862a.stderr
- + testsuite/tests/deSugar/should_compile/T27862b.hs
- + testsuite/tests/deSugar/should_compile/T27862b.stderr
- + testsuite/tests/deSugar/should_compile/T27862c.hs
- + testsuite/tests/deSugar/should_compile/T27862c.stderr
- + testsuite/tests/deSugar/should_compile/T27862d.hs
- + testsuite/tests/deSugar/should_compile/T27862d.stderr
- + testsuite/tests/deSugar/should_compile/T28137.hs
- + testsuite/tests/deSugar/should_compile/T28137.stderr
- testsuite/tests/deSugar/should_compile/all.T
- testsuite/tests/deSugar/should_run/dsrun008.stderr
- testsuite/tests/driver/mkdepend/all.T
- + testsuite/tests/driver/mkdepend/mhu04/app/Main.hs
- + testsuite/tests/driver/mkdepend/mhu04/app/Utils.hs
- + testsuite/tests/driver/mkdepend/mhu04/lib/Lib.hs
- + testsuite/tests/driver/mkdepend/mhu04/lib/Lib/Internal.hs
- + testsuite/tests/driver/mkdepend/mhu04/unitApp
- + testsuite/tests/driver/mkdepend/mhu04/unitLib
- + testsuite/tests/driver/mkdepend/mhu05/app/Main.hs
- + testsuite/tests/driver/mkdepend/mhu05/lib/Lib.hs
- + testsuite/tests/driver/mkdepend/mhu05/lib/Lib/Internal.hs
- + testsuite/tests/driver/mkdepend/mhu05/test/Spec.hs
- + testsuite/tests/driver/mkdepend/mhu05/unitApp
- + testsuite/tests/driver/mkdepend/mhu05/unitLib
- + testsuite/tests/driver/mkdepend/mhu05/unitTest
- + testsuite/tests/driver/mkdepend/mkdepend02.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend02/Main.hs
- + testsuite/tests/driver/mkdepend/mkdepend_bkp_01/bkp01.bkp
- + testsuite/tests/driver/mkdepend/mkdepend_mhu04.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend_mhu04.dep-makefile
- + testsuite/tests/driver/mkdepend/mkdepend_mhu05.dep-json
- + testsuite/tests/driver/mkdepend/mkdepend_mhu05.dep-makefile
- testsuite/tests/ghc-api/exactprint/T22919.stderr
- testsuite/tests/ghc-api/exactprint/Test20239.stderr
- testsuite/tests/ghc-api/exactprint/ZeroWidthSemi.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T17544_kw.stderr
- testsuite/tests/haddock/should_compile_flag_haddock/T24221.stderr
- testsuite/tests/module/mod185.stderr
- testsuite/tests/parser/should_compile/DumpParsedAst.stderr
- testsuite/tests/parser/should_compile/DumpParsedAstComments.stderr
- testsuite/tests/parser/should_compile/DumpRenamedAst.stderr
- testsuite/tests/parser/should_compile/DumpSemis.hs
- testsuite/tests/parser/should_compile/DumpSemis.stderr
- testsuite/tests/parser/should_compile/KindSigs.stderr
- testsuite/tests/parser/should_compile/T14189.stderr
- testsuite/tests/parser/should_compile/T15279.stderr
- testsuite/tests/parser/should_compile/T15323.stderr
- testsuite/tests/parser/should_compile/T20452.stderr
- testsuite/tests/parser/should_compile/T20718.stderr
- testsuite/tests/parser/should_compile/T20846.stderr
- testsuite/tests/perf/compiler/hard_hole_fits.stderr
- testsuite/tests/pmcheck/should_compile/T24234.stderr
- + testsuite/tests/printer/Layout.hs
- testsuite/tests/printer/Makefile
- testsuite/tests/printer/Ppr003.hs
- testsuite/tests/printer/T18791.stderr
- + testsuite/tests/printer/Test20297.expected.hs
- testsuite/tests/printer/Test20297.hs
- testsuite/tests/printer/Test20297.stdout
- + testsuite/tests/printer/Test20297MD.stdout
- testsuite/tests/printer/Test24533.stdout
- testsuite/tests/printer/all.T
- testsuite/tests/rts/IOManager.hsc
- testsuite/tests/rts/all.T
- + testsuite/tests/th/T27826.hs
- testsuite/tests/th/all.T
- + testsuite/tests/typecheck/should_compile/T28135.hs
- testsuite/tests/typecheck/should_compile/all.T
- testsuite/tests/typecheck/should_fail/tcfail203a.stderr
- utils/check-exact/ExactPrint.hs
- utils/check-exact/Main.hs
- utils/check-exact/Parsers.hs
- utils/check-exact/Transform.hs
- utils/check-exact/Utils.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
- utils/haddock/haddock-api/src/Haddock/Backends/LaTeX.hs
- utils/haddock/haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
- utils/haddock/haddock-api/src/Haddock/Convert.hs
- utils/haddock/haddock-api/src/Haddock/GhcUtils.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Create.hs
- utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
- utils/haddock/haddock-api/src/Haddock/Types.hs
The diff was not included because it is too large.
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d3c831edcf3ce878361dd25b794900…
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/d3c831edcf3ce878361dd25b794900…
You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
1
0