Simon Peyton Jones pushed to branch wip/T28169 at Glasgow Haskell Compiler / GHC
Commits:
-
36da5e74
by Simon Peyton Jones at 2026-11-28T23:47:01+00:00
-
e3d48dcf
by Simon Peyton Jones at 2026-11-28T23:47:01+00:00
-
17559045
by Simon Peyton Jones at 2026-11-29T01:18:21+00:00
10 changed files:
- compiler/GHC/Core/Opt/Simplify/Inline.hs
- compiler/GHC/Core/Opt/Simplify/Iteration.hs
- compiler/GHC/Core/Opt/Simplify/Utils.hs
- compiler/GHC/Core/TyCo/Make.hs
- compiler/GHC/Types/Demand.hs
- libraries/ghc-internal/src/GHC/Internal/IO.hs
- + testsuite/tests/simplCore/should_compile/T26548.hs
- + testsuite/tests/simplCore/should_compile/T26548.stderr
- testsuite/tests/simplCore/should_compile/T26615.stderr
- testsuite/tests/simplCore/should_compile/all.T
Changes:
| ... | ... | @@ -385,7 +385,7 @@ tryUnfolding env logger id lone_variable arg_infos |
| 385 | 385 | -- be *something* interesting about some argument, or the
|
| 386 | 386 | -- result context, to make it worth inlining
|
| 387 | 387 | calc_some_benefit :: Arity -> Bool -> Bool -- The Arity is the number of args
|
| 388 | - -- expected by the unfolding
|
|
| 388 | + -- expected by the unfolding
|
|
| 389 | 389 | calc_some_benefit uf_arity is_inline
|
| 390 | 390 | | not saturated = interesting_args -- Under-saturated
|
| 391 | 391 | -- Note [Unsaturated applications]
|
| ... | ... | @@ -3557,7 +3557,8 @@ life" in one of two ways: |
| 3557 | 3557 | |
| 3558 | 3558 | Thus, when we are simply reconstructing a case (the common case), and the
|
| 3559 | 3559 | case binder is not dead, or the scrutinee is a variable, we zap the
|
| 3560 | -occurrence info on DataAlt field binders. See `adjustFieldOccInfo`.
|
|
| 3560 | +occurrence info on DataAlt field binders. See `fieldOccInfoStable`
|
|
| 3561 | +and `adjustFieldsIdInfo`.
|
|
| 3561 | 3562 | |
| 3562 | 3563 | Note [Improving seq]
|
| 3563 | 3564 | ~~~~~~~~~~~~~~~~~~~~
|
| ... | ... | @@ -3765,70 +3766,81 @@ do it here). The right thing is to do some kind of binder-swap; |
| 3765 | 3766 | see #15226 for discussion.
|
| 3766 | 3767 | -}
|
| 3767 | 3768 | |
| 3768 | -adjustFieldsIdInfo :: Maybe OutExpr -> OutId -> BinderSwapDecision -> DataCon -> [Id] -> [Id]
|
|
| 3769 | +adjustFieldsIdInfo :: Maybe OutExpr -> OutId -> BinderSwapDecision
|
|
| 3770 | + -> DataCon -> [InBndr] -> [InBndr]
|
|
| 3769 | 3771 | -- See Note [Adding evaluatedness info to pattern-bound variables]
|
| 3770 | 3772 | -- and Note [DataAlt occ info]
|
| 3773 | +--
|
|
| 3774 | +-- This can be a hot path in the compiler (e.g. T9233 which has a large strict record)
|
|
| 3775 | +-- Hence
|
|
| 3776 | +-- (a) we build the result list strictly: it is consumed in full right away,
|
|
| 3777 | +-- so thunks for the elements or the spine are pure waste
|
|
| 3778 | +-- (b) we update each field binder's IdInfo at most once
|
|
| 3779 | +-- (c) we leave alone a field binder that is dead and will stay dead
|
|
| 3780 | +-- (see `fieldOccInfoStable`); its evaluated-ness is irrelevant
|
|
| 3771 | 3781 | adjustFieldsIdInfo scrut case_bndr bndr_swap con vs
|
| 3782 | + |
|
| 3772 | 3783 | -- Deal with seq# applications
|
| 3784 | + -- See (SEQ3) in Note [seq# magic] in GHC.Types.Id.Make
|
|
| 3785 | + -- case (seq# a b) of (# _, x' #) -> ....
|
|
| 3786 | + -- we can mark x' as evaluated
|
|
| 3773 | 3787 | | Just scr <- scrut
|
| 3774 | 3788 | , isUnboxedTupleDataCon con
|
| 3775 | - , [s,x] <- vs
|
|
| 3776 | 3789 | -- Use stripNArgs rather than collectArgsTicks to avoid building
|
| 3777 | 3790 | -- a list of arguments only to throw it away immediately.
|
| 3778 | 3791 | , Just (Var f) <- stripNArgs 4 scr
|
| 3779 | 3792 | , f `hasKey` seqHashKey
|
| 3780 | - , let x' = setCaseBndrEvald MarkedStrict x
|
|
| 3781 | - = map (adjustFieldOccInfo case_bndr bndr_swap) [s, x']
|
|
| 3782 | - |
|
| 3783 | - -- Deal with banged datacon fields
|
|
| 3784 | - -- This case is quite allocation sensitive to T9233 which has a large record
|
|
| 3785 | - -- with strict fields. Hence we try not to update vs twice!
|
|
| 3786 | -adjustFieldsIdInfo _scrut case_bndr bndr_swap con vs
|
|
| 3787 | - | Nothing <- dataConWrapId_maybe con
|
|
| 3788 | - -- A common fast path; no need to allocate the_strs when they are all lazy
|
|
| 3789 | - -- anyway! It shaves off 2% in T9675
|
|
| 3790 | - = map (adjustFieldOccInfo case_bndr bndr_swap) vs
|
|
| 3793 | + = go vs [topDmd, evalDmd] -- seq# returns an evaluated x
|
|
| 3794 | + |
|
| 3795 | + -- General case
|
|
| 3791 | 3796 | | otherwise
|
| 3792 | 3797 | = go vs wkr_dmds
|
| 3793 | 3798 | where
|
| 3794 | 3799 | -- The demand signature of the worker has a strict demand for exactly the
|
| 3795 | - -- strict (banged) fields; one demand for each value argument, including
|
|
| 3800 | + -- strict (banged) fields; one demand for each value argument, /including/
|
|
| 3796 | 3801 | -- existential CoVars. See GHC.Types.Id.Make.mkDataConWorkId.
|
| 3797 | - -- NB: we do /not/ mark an unlifted field as evaluated: that gains nothing,
|
|
| 3798 | - -- and an OtherCon[] unfolding makes `interestingArg` say NonTrivArg,
|
|
| 3799 | - -- which changes inlining decisions (we saw this in compiler/perf/T19695).
|
|
| 3802 | + -- NB: an unlifted field has a lazy demand, and hence won't be marked as
|
|
| 3803 | + -- evaluated: doing so gains nothing. Not a big deal because `interestingArg`
|
|
| 3804 | + -- says `TrivArg` for OtherCon[] unfoldings, but it's a bit delicate
|
|
| 3805 | + -- (compiler/perf/T19695 is an example of this delicacy)
|
|
| 3800 | 3806 | DmdSig (DmdType _ wkr_dmds) = idDmdSig (dataConWorkId con)
|
| 3807 | + occ_stable = fieldOccInfoStable case_bndr bndr_swap
|
|
| 3801 | 3808 | |
| 3802 | 3809 | go [] [] = []
|
| 3803 | - go (v:vs') dmds | isTyVar v = v : go vs' dmds
|
|
| 3804 | - go (v:vs') (dmd:dmds) = adjustFieldOccInfo case_bndr bndr_swap (set_evald dmd v) : go vs' dmds
|
|
| 3805 | - go _ _ = pprPanic "Simplify.adjustFieldsIdInfo"
|
|
| 3806 | - (ppr con $$
|
|
| 3807 | - ppr vs $$
|
|
| 3808 | - ppr_with_length wkr_dmds $$
|
|
| 3809 | - ppr_with_length (dataConRepArgTys con))
|
|
| 3810 | - where
|
|
| 3811 | - ppr_with_length list
|
|
| 3812 | - = ppr list <+> parens (text "length =" <+> ppr (length list))
|
|
| 3813 | - |
|
| 3814 | - set_evald dmd v | isStrDataConDmd dmd = setCaseBndrEvald MarkedStrict v
|
|
| 3815 | - | otherwise = v
|
|
| 3816 | - |
|
| 3817 | -adjustFieldOccInfo :: OutId -> BinderSwapDecision -> CoreBndr -> CoreBndr
|
|
| 3818 | --- Kill occ info if we do binder swap and the case binder is alive;
|
|
| 3819 | --- see Note [DataAlt occ info]
|
|
| 3820 | -adjustFieldOccInfo case_bndr bndr_swap field_bndr
|
|
| 3821 | - | isTyVar field_bndr
|
|
| 3822 | - = field_bndr
|
|
| 3823 | - |
|
| 3824 | - | not (isDeadBinder case_bndr) -- (1) in the Note: If the case binder is alive,
|
|
| 3825 | - = zapIdOccInfo field_bndr -- the field binders might come back alive
|
|
| 3826 | - |
|
| 3827 | - | DoBinderSwap{} <- bndr_swap -- (2) in the Note: If binder swap might take place,
|
|
| 3828 | - = zapIdOccInfo field_bndr -- the case binder might come back alive
|
|
| 3829 | - |
|
| 3830 | - | otherwise
|
|
| 3831 | - = field_bndr -- otherwise the field binders stay dead
|
|
| 3810 | + go (v:vs') dmds@(dmd:dmds')
|
|
| 3811 | + | isTyVar v = let !vs'' = go vs' dmds in v : vs''
|
|
| 3812 | + | otherwise = let !v' = adjust dmd v
|
|
| 3813 | + !vs'' = go vs' dmds'
|
|
| 3814 | + in v' : vs''
|
|
| 3815 | + go vs' ds = pprPanic "Simplify.adjustFieldsIdInfo" (ppr con $$ ppr vs $$ ppr vs' $$ ppr ds)
|
|
| 3816 | + |
|
| 3817 | + -- Set evaluated-ness (if dmd is strict) and zap occ-info
|
|
| 3818 | + -- (if not occ_stable), with at most one IdInfo update
|
|
| 3819 | + adjust :: Demand -> Id -> Id
|
|
| 3820 | + adjust dmd v
|
|
| 3821 | + = case isStrDataConDmd dmd of
|
|
| 3822 | + True | occ_stable -> if isDeadBinder v then nop v else set_evald v
|
|
| 3823 | + | otherwise -> set_evald_zap_occ v
|
|
| 3824 | + False | occ_stable -> nop v
|
|
| 3825 | + | otherwise -> zap_occ v
|
|
| 3826 | + |
|
| 3827 | + nop v = v
|
|
| 3828 | + set_evald v = v `setIdUnfolding` evaldUnfolding
|
|
| 3829 | + zap_occ v = zapIdOccInfo v
|
|
| 3830 | + set_evald_zap_occ v = modifyIdInfo (\info -> info `setUnfoldingInfo` evaldUnfolding
|
|
| 3831 | + `setOccInfo` noOccInfo) v
|
|
| 3832 | + |
|
| 3833 | +fieldOccInfoStable :: OutId -> BinderSwapDecision -> Bool
|
|
| 3834 | +-- True <=> the occ-info on the field binders of a DataAlt remains valid;
|
|
| 3835 | +-- in particular a dead field binder will stay dead.
|
|
| 3836 | +-- False <=> we must zap the field binders' occ-info.
|
|
| 3837 | +-- See Note [DataAlt occ info]
|
|
| 3838 | +fieldOccInfoStable case_bndr bndr_swap
|
|
| 3839 | + | not (isDeadBinder case_bndr) = False -- (1) in the Note: If the case binder is alive,
|
|
| 3840 | + -- the field binders might come back alive
|
|
| 3841 | + | DoBinderSwap{} <- bndr_swap = False -- (2) in the Note: If binder swap might take place,
|
|
| 3842 | + -- the case binder might come back alive
|
|
| 3843 | + | otherwise = True -- Otherwise the field binders stay dead
|
|
| 3832 | 3844 | |
| 3833 | 3845 | addDefaultUnfoldings :: SimplEnv -> OutId -> BinderSwapDecision -> [AltCon] -> SimplEnv
|
| 3834 | 3846 | addDefaultUnfoldings env case_bndr bndr_swap imposs_deflt_cons
|
| ... | ... | @@ -1123,7 +1123,7 @@ interestingCallContext env cont |
| 1123 | 1123 | -- in GHC.Core.Unfold
|
| 1124 | 1124 | |
| 1125 | 1125 | interesting (StrictArg { sc_fun = fun }) = strictArgContext fun
|
| 1126 | - interesting (StrictBind {}) = BoringCtxt
|
|
| 1126 | + interesting (StrictBind {}) = RhsCtxt NonRecursive
|
|
| 1127 | 1127 | interesting (Stop _ cci _) = cci
|
| 1128 | 1128 | interesting (TickIt _ k) = interesting k
|
| 1129 | 1129 | interesting (ApplyToTy { sc_cont = k }) = interesting k
|
| ... | ... | @@ -1208,13 +1208,29 @@ Wrinkles: |
| 1208 | 1208 | |
| 1209 | 1209 | (IA2) OtherCon.
|
| 1210 | 1210 | interestingArg returns
|
| 1211 | - (a) NonTrivArg for an arg with an OtherCon [] unfolding
|
|
| 1211 | + (a) TrivArg for an arg with an OtherCon [] unfolding
|
|
| 1212 | 1212 | (b) ValueArg for an arg with an OtherCon [c1,c2..] unfolding.
|
| 1213 | 1213 | |
| 1214 | - Reason for (a): I found (in the GHC.Internal.Bignum.Integer module) that I was
|
|
| 1215 | - inlining a pretty big function when all we knew was that its arguments
|
|
| 1216 | - were evaluated, nothing more. That in turn make the enclosing function
|
|
| 1217 | - too big to inline elsewhere.
|
|
| 1214 | + Reason for (a): knowing only that an argument is evaluated, but not which
|
|
| 1215 | + constructor it is, rarely makes inlining worthwhile. For example, in test
|
|
| 1216 | + T18140 we have
|
|
| 1217 | + data D = D !(Maybe Bool) ... !(Maybe Bool)
|
|
| 1218 | + maMB :: Maybe Bool -> Maybe Bool -> Maybe Bool
|
|
| 1219 | + maD (D x1 ... x18) (D y1 ... y18) = D (maMB x1 y1) ... (maMB x18 y18)
|
|
| 1220 | + The xi and yi come from strict fields, so they have OtherCon [] unfoldings.
|
|
| 1221 | + If that made them interesting we would inline maMB 18 times, to no benefit,
|
|
| 1222 | + just bloating maD. (Similarly, in GHC.Internal.Bignum.Integer I found that
|
|
| 1223 | + I was inlining a pretty big function when all we knew was that its
|
|
| 1224 | + arguments were evaluated. That in turn made the enclosing function too big
|
|
| 1225 | + to inline elsewhere.)
|
|
| 1226 | + |
|
| 1227 | + But this choice is delicate. Sometimes inlining a tiny function applied to
|
|
| 1228 | + an evaluated argument /is/ very beneficial, because the /result/ is
|
|
| 1229 | + scrutinised downstream; mkSymMCo in the type-family rewriter is an example.
|
|
| 1230 | + Neither the argument nor the call context reveals this, so in those cases
|
|
| 1231 | + we use an INLINE pragma: see Note [Inline tiny MCo functions] in
|
|
| 1232 | + GHC.Core.TyCo.Make. (Without those INLINE pragmas, returning TrivArg here
|
|
| 1233 | + makes the compiler itself slower: T9872{a,b,c,d} allocate ~2.5% more.)
|
|
| 1218 | 1234 | |
| 1219 | 1235 | Reason for (b): we want to inline integerCompare here
|
| 1220 | 1236 | integerLt# :: Integer -> Integer -> Bool#
|
| ... | ... | @@ -1247,6 +1263,25 @@ Wrinkles: |
| 1247 | 1263 | Conclusion: `interestingArg` should give some encouragement (NonTrivArg) to `f`
|
| 1248 | 1264 | when the argument is expandable. Hence `uf_expandable` in the `Var` case.
|
| 1249 | 1265 | |
| 1266 | +(IA5) We are keen to inline a higher-order function applied to lambda, e.g.
|
|
| 1267 | + f (\x. blah)
|
|
| 1268 | + where
|
|
| 1269 | + f h = ...(h xs)...
|
|
| 1270 | + Doing so specialises `f` to the particular argument which can make a
|
|
| 1271 | + big difference. Note, however, that we don't want to be defeated if
|
|
| 1272 | + the lambda is let-bound:
|
|
| 1273 | + let h = (\x.blah)
|
|
| 1274 | + in ...f h...
|
|
| 1275 | + So we need to look through h's unfolding.
|
|
| 1276 | + |
|
| 1277 | + This makes parser combinators, which are usually applied to functions,
|
|
| 1278 | + rather keen to inline, so whether they do so is mostly decided by their
|
|
| 1279 | + size. Test T17516 is a delicate example: if `max` on positions inlines
|
|
| 1280 | + into the combinators in T17516A, the combinators are too big to inline into
|
|
| 1281 | + the client module T17516; if not (because max's arguments are merely
|
|
| 1282 | + evaluated, see (IA2)), they are small and do inline, making T17516 itself
|
|
| 1283 | + slower to compile. But inlining makes the code better too, with fewer
|
|
| 1284 | + unknown calls.
|
|
| 1250 | 1285 | -}
|
| 1251 | 1286 | |
| 1252 | 1287 | interestingArg :: SimplEnv -> StaticEnv -> CoreExpr -> ArgSummary
|
| ... | ... | @@ -1275,7 +1310,7 @@ interestingArg env se e |
| 1275 | 1310 | go env n (Lam v e)
|
| 1276 | 1311 | | isTyVar v = go env n e
|
| 1277 | 1312 | | n>0 = NonTrivArg -- (\x.b) e is NonTriv
|
| 1278 | - | otherwise = ValueArg
|
|
| 1313 | + | otherwise = ValueArg -- (\x.b) is Value: see (IA5)
|
|
| 1279 | 1314 | go _ _ (Case {}) = NonTrivArg
|
| 1280 | 1315 | go env n (Let b e) = case go env' n e of
|
| 1281 | 1316 | ValueArg -> ValueArg
|
| ... | ... | @@ -1285,17 +1320,16 @@ interestingArg env se e |
| 1285 | 1320 | |
| 1286 | 1321 | go_var n v
|
| 1287 | 1322 | | isConLikeId v = ValueArg -- Experimenting with 'conlike' rather that
|
| 1288 | - -- data constructors here
|
|
| 1289 | - -- DFuns are con-like;
|
|
| 1323 | + -- data constructors here (includes DFuns)
|
|
| 1290 | 1324 | -- see (IA1) in Note [Interesting arguments]
|
| 1291 | - | idArity v > n = ValueArg -- Catches (eg) primops with arity but no unfolding
|
|
| 1325 | + | idArity v > n = ValueArg -- See (IA5) in Note [Interesting arguments]
|
|
| 1292 | 1326 | | n > 0 = NonTrivArg -- Saturated or unknown call
|
| 1293 | 1327 | | otherwise -- n==0, no value arguments; look for an interesting unfolding
|
| 1294 | 1328 | = case idUnfolding v of
|
| 1295 | - OtherCon [] -> NonTrivArg -- It's evaluated, but that's all we know
|
|
| 1329 | + OtherCon [] -> TrivArg -- It's evaluated, but that's all we know
|
|
| 1296 | 1330 | OtherCon _ -> ValueArg -- Evaluated and we know it isn't these constructors
|
| 1297 | - -- See (IA2) in Note [Interesting arguments]
|
|
| 1298 | - DFunUnfolding {} -> ValueArg -- We konw that idArity=0
|
|
| 1331 | + -- See (IA2) in Note [Interesting arguments]
|
|
| 1332 | + DFunUnfolding {} -> ValueArg -- We know that idArity=0
|
|
| 1299 | 1333 | CoreUnfolding{ uf_cache = cache }
|
| 1300 | 1334 | | uf_is_conlike cache -> ValueArg -- Includes constructor applications
|
| 1301 | 1335 | | uf_expandable cache -> NonTrivArg -- See (IA4)
|
| ... | ... | @@ -1322,42 +1322,88 @@ mkGReflCo r ty mco |
| 1322 | 1322 | mkGReflMCo :: HasDebugCallStack => Role -> Type -> CoercionN -> Coercion
|
| 1323 | 1323 | mkGReflMCo r ty co = mkGReflCo r ty (MCo co)
|
| 1324 | 1324 | |
| 1325 | +{- Note [Inline tiny MCo functions]
|
|
| 1326 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
| 1327 | +The MCoercion functions (mkSymMCo, mkCastTyMCo, mkCoherenceRightMCo, etc.)
|
|
| 1328 | +are tiny wrappers whose whole purpose is the fast path for MRefl. We give
|
|
| 1329 | +them INLINE pragmas, rather than relying on the inliner's heuristics, because
|
|
| 1330 | +the benefit of inlining them is usually invisible at the call site.
|
|
| 1331 | + |
|
| 1332 | +Example: homogeniseHetRedn (in GHC.Core.Reduction) is used in the type-family
|
|
| 1333 | +rewriter. After inlining it and mkCoherenceRightMRedn (both INLINE) we get
|
|
| 1334 | +something like
|
|
| 1335 | + let kco' = mkSymMCo kco
|
|
| 1336 | + in Reduction (mkCoherenceRightMCo r ty2 kco' co1)
|
|
| 1337 | + (mkCastTyMCo ty2 kco')
|
|
| 1338 | +where `kco` is typically already evaluated (has an OtherCon [] unfolding),
|
|
| 1339 | +but its constructor is unknown. `kco'` is used twice, so it is not inlined
|
|
| 1340 | +at its use sites; and its RHS is a boring context for a non-INLINE function.
|
|
| 1341 | +So, judged by its argument and context alone, `mkSymMCo kco` has no
|
|
| 1342 | +discernible benefit, and does not inline. But if it does inline, case-of-case
|
|
| 1343 | +moves the (cheap) `case kco` outwards, and the two consumers become
|
|
| 1344 | +case-of-known-constructor:
|
|
| 1345 | + case kco of
|
|
| 1346 | + MRefl -> Reduction co1 ty2 -- No allocation at all
|
|
| 1347 | + MCo co -> ...
|
|
| 1348 | +Kind coercions are usually reflexive, so this MRefl path is the hot one.
|
|
| 1349 | +The benefit comes entirely from the downstream consumers of the result.
|
|
| 1350 | + |
|
| 1351 | +Why not just make interestingArg regard an evaluated (OtherCon []) argument as
|
|
| 1352 | +interesting? Because in exactly the same situation it causes useless
|
|
| 1353 | +inlining: see `maMB` in test T18140, where the arguments come from strict
|
|
| 1354 | +fields and the result goes into a constructor field. See (IA2) in
|
|
| 1355 | +Note [Interesting arguments] in GHC.Core.Opt.Simplify.Utils.
|
|
| 1356 | + |
|
| 1357 | +Being tiny, these functions cost little to inline even when nothing is known
|
|
| 1358 | +about the argument. Without these pragmas, tests T9872{a,b,c,d} and
|
|
| 1359 | +TcPlugin_RewritePerf allocated around 2.5% more (Nov 2026), almost all of it
|
|
| 1360 | +due to out-of-line calls of mkSymMCo from GHC.Tc.Solver.Rewrite.
|
|
| 1361 | +-}
|
|
| 1362 | + |
|
| 1325 | 1363 | -- | Compose two MCoercions via transitivity
|
| 1326 | 1364 | mkTransMCo :: MCoercion -> MCoercion -> MCoercion
|
| 1327 | 1365 | mkTransMCo MRefl co2 = co2
|
| 1328 | 1366 | mkTransMCo co1 MRefl = co1
|
| 1329 | 1367 | mkTransMCo (MCo co1) (MCo co2) = MCo (mkTransCo co1 co2)
|
| 1368 | +{-# INLINE mkTransMCo #-} -- See Note [Inline tiny MCo functions]
|
|
| 1330 | 1369 | |
| 1331 | 1370 | mkTransMCoL :: MCoercion -> Coercion -> MCoercion
|
| 1332 | 1371 | mkTransMCoL MRefl co2 = coToMCo co2
|
| 1333 | 1372 | mkTransMCoL (MCo co1) co2 = MCo (mkTransCo co1 co2)
|
| 1373 | +{-# INLINE mkTransMCoL #-} -- See Note [Inline tiny MCo functions]
|
|
| 1334 | 1374 | |
| 1335 | 1375 | mkTransMCoR :: Coercion -> MCoercion -> MCoercion
|
| 1336 | 1376 | mkTransMCoR co1 MRefl = coToMCo co1
|
| 1337 | 1377 | mkTransMCoR co1 (MCo co2) = MCo (mkTransCo co1 co2)
|
| 1378 | +{-# INLINE mkTransMCoR #-} -- See Note [Inline tiny MCo functions]
|
|
| 1338 | 1379 | |
| 1339 | 1380 | -- | Get the reverse of an 'MCoercion'
|
| 1340 | 1381 | mkSymMCo :: MCoercion -> MCoercion
|
| 1341 | 1382 | mkSymMCo MRefl = MRefl
|
| 1342 | 1383 | mkSymMCo (MCo co) = MCo (mkSymCo co)
|
| 1384 | +{-# INLINE mkSymMCo #-} -- See Note [Inline tiny MCo functions]
|
|
| 1343 | 1385 | |
| 1344 | 1386 | -- | Cast a type by an 'MCoercion'
|
| 1345 | 1387 | mkCastTyMCo :: Type -> MCoercion -> Type
|
| 1346 | 1388 | mkCastTyMCo ty MRefl = ty
|
| 1347 | 1389 | mkCastTyMCo ty (MCo co) = ty `mkCastTy` co
|
| 1390 | +{-# INLINE mkCastTyMCo #-} -- See Note [Inline tiny MCo functions]
|
|
| 1348 | 1391 | |
| 1349 | 1392 | mkGReflLeftMCo :: Role -> Type -> MCoercionN -> Coercion
|
| 1350 | 1393 | mkGReflLeftMCo r ty MRefl = mkReflCo r ty
|
| 1351 | 1394 | mkGReflLeftMCo r ty (MCo co) = mkGReflLeftCo r ty co
|
| 1395 | +{-# INLINE mkGReflLeftMCo #-} -- See Note [Inline tiny MCo functions]
|
|
| 1352 | 1396 | |
| 1353 | 1397 | mkGReflRightMCo :: Role -> Type -> MCoercionN -> Coercion
|
| 1354 | 1398 | mkGReflRightMCo r ty MRefl = mkReflCo r ty
|
| 1355 | 1399 | mkGReflRightMCo r ty (MCo co) = mkGReflRightCo r ty co
|
| 1400 | +{-# INLINE mkGReflRightMCo #-} -- See Note [Inline tiny MCo functions]
|
|
| 1356 | 1401 | |
| 1357 | 1402 | -- | Like 'mkCoherenceRightCo', but with an 'MCoercion'
|
| 1358 | 1403 | mkCoherenceRightMCo :: Role -> Type -> MCoercionN -> Coercion -> Coercion
|
| 1359 | 1404 | mkCoherenceRightMCo _ _ MRefl co2 = co2
|
| 1360 | 1405 | mkCoherenceRightMCo r ty (MCo co) co2 = mkCoherenceRightCo r ty co co2
|
| 1406 | +{-# INLINE mkCoherenceRightMCo #-} -- See Note [Inline tiny MCo functions]
|
|
| 1361 | 1407 | |
| 1362 | 1408 | isReflMCo :: MCoercion -> Bool
|
| 1363 | 1409 | isReflMCo MRefl = True
|
| ... | ... | @@ -1003,9 +1003,10 @@ isStrUsedDmd :: Demand -> Bool |
| 1003 | 1003 | isStrUsedDmd (n :* _) = isStrict n && not (isAbs n)
|
| 1004 | 1004 | |
| 1005 | 1005 | -- | Is this demand, taken from the demand signature of a data constructor
|
| 1006 | --- /worker/, the demand for a strict field? The demands in a worker's
|
|
| 1007 | --- signature are never absent (see GHC.Types.Id.Make.mkDataConWorkId), so
|
|
| 1008 | --- unlike 'isStrUsedDmd' we don't need to check for absence.
|
|
| 1006 | +-- /worker/, the demand for a strict field? It would be more obviously correct
|
|
| 1007 | +-- to use isStrUsedDmd, in case the dmd is Absent. But data constructor workers
|
|
| 1008 | +-- never have absent arguments, and isStrictDmd is more efficient.
|
|
| 1009 | +-- See GHC.Types.Id.Make.mkDataConWorkId.
|
|
| 1009 | 1010 | isStrDataConDmd :: Demand -> Bool
|
| 1010 | 1011 | isStrDataConDmd = isStrictDmd
|
| 1011 | 1012 |
| ... | ... | @@ -483,7 +483,7 @@ a `finally` sequel = |
| 483 | 483 | -- | The primitive used to implement 'GHC.IO.evaluate'.
|
| 484 | 484 | -- Prefer to use 'GHC.IO.evaluate' whenever possible!
|
| 485 | 485 | seq# :: forall a s. a -> State# s -> (# State# s, a #)
|
| 486 | --- See Note [seq# magic] in GHC.Types.Id.Make
|
|
| 486 | +-- See Note [seq# magic] in GHC.Builtin.WiredIn.Ids
|
|
| 487 | 487 | {-# NOINLINE seq# #-} -- seq# is inlined manually in CorePrep
|
| 488 | 488 | seq# a s = let !a' = lazy a in (# s, a' #)
|
| 489 | 489 |
| 1 | +module T26548 where
|
|
| 2 | + |
|
| 3 | +newtype N a = MkN (Maybe a)
|
|
| 4 | +data T = MkT !(N Int) !(N Bool)
|
|
| 5 | + |
|
| 6 | +f x = case x of { MkT a b ->
|
|
| 7 | + case x of { MkT c d -> MkT a d } } |
| 1 | + |
|
| 2 | +==================== Tidy Core ====================
|
|
| 3 | +Result size of Tidy Core
|
|
| 4 | + = {terms: 3, types: 3, coercions: 0, joins: 0/0}
|
|
| 5 | + |
|
| 6 | +-- RHS size: {terms: 2, types: 1, coercions: 0, joins: 0/0}
|
|
| 7 | +f :: T -> T
|
|
| 8 | +[GblId,
|
|
| 9 | + Arity=1,
|
|
| 10 | + Str=<1!P(L,L)>,
|
|
| 11 | + Cpr=1,
|
|
| 12 | + Unf=Unf{Src=StableSystem, TopLvl=True,
|
|
| 13 | + Value=True, ConLike=True, WorkFree=True, Expandable=True,
|
|
| 14 | + Guidance=ALWAYS_IF(arity=1,unsat_ok=True,boring_ok=True)
|
|
| 15 | + Tmpl= \ (x [Occ=Once1] :: T) -> x}]
|
|
| 16 | +f = \ (x :: T) -> x
|
|
| 17 | + |
|
| 18 | + |
|
| 19 | + |
| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | |
| 3 | 3 | ==================== Tidy Core ====================
|
| 4 | 4 | Result size of Tidy Core
|
| 5 | - = {terms: 1,229, types: 1,163, coercions: 18, joins: 17/29}
|
|
| 5 | + = {terms: 1,220, types: 1,160, coercions: 18, joins: 17/29}
|
|
| 6 | 6 | |
| 7 | 7 | -- RHS size: {terms: 6, types: 8, coercions: 0, joins: 0/0}
|
| 8 | 8 | unArray :: forall a. Array a -> SmallArray# a
|
| ... | ... | @@ -107,7 +107,7 @@ T26615a.$tcLeaf |
| 107 | 107 | T26615a.$trModule
|
| 108 | 108 | $tcLeaf2
|
| 109 | 109 | 0#
|
| 110 | - GHC.Internal.Types.krep$*->*->*
|
|
| 110 | + krepStarArrStarArr
|
|
| 111 | 111 | |
| 112 | 112 | -- RHS size: {terms: 3, types: 2, coercions: 0, joins: 0/0}
|
| 113 | 113 | $krep7 :: [GHC.Internal.Types.KindRep]
|
| ... | ... | @@ -181,7 +181,7 @@ T26615a.$tcArray |
| 181 | 181 | T26615a.$trModule
|
| 182 | 182 | $tcArray2
|
| 183 | 183 | 0#
|
| 184 | - GHC.Internal.Types.krep$*Arr*
|
|
| 184 | + krepStarArr
|
|
| 185 | 185 | |
| 186 | 186 | -- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
|
| 187 | 187 | $krep12 :: GHC.Internal.Types.KindRep
|
| ... | ... | @@ -251,7 +251,7 @@ T26615a.$tcHashMap |
| 251 | 251 | T26615a.$trModule
|
| 252 | 252 | $tcHashMap2
|
| 253 | 253 | 0#
|
| 254 | - GHC.Internal.Types.krep$*->*->*
|
|
| 254 | + krepStarArrStarArr
|
|
| 255 | 255 | |
| 256 | 256 | -- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
|
| 257 | 257 | $krep16 :: GHC.Internal.Types.KindRep
|
| ... | ... | @@ -612,7 +612,7 @@ lvl1 |
| 612 | 612 | = GHC.Internal.Control.Exception.Base.patError @LiftedRep @() lvl
|
| 613 | 613 | |
| 614 | 614 | Rec {
|
| 615 | --- RHS size: {terms: 136, types: 130, coercions: 0, joins: 1/2}
|
|
| 615 | +-- RHS size: {terms: 133, types: 129, coercions: 0, joins: 1/2}
|
|
| 616 | 616 | T26615a.disjointSubtrees_$s$wdisjointSubtrees [InlPrag=INLINABLE[2],
|
| 617 | 617 | Occ=LoopBreaker]
|
| 618 | 618 | :: forall k a b.
|
| ... | ... | @@ -635,7 +635,6 @@ T26615a.disjointSubtrees_$s$wdisjointSubtrees |
| 635 | 635 | Empty -> GHC.Internal.Types.True;
|
| 636 | 636 | Leaf bx ds ->
|
| 637 | 637 | case ds of { L kB ds1 ->
|
| 638 | - case kB of k0 { __DEFAULT ->
|
|
| 639 | 638 | case eqWord# bx sc2 of {
|
| 640 | 639 | __DEFAULT -> GHC.Internal.Types.True;
|
| 641 | 640 | 1# ->
|
| ... | ... | @@ -668,8 +667,7 @@ T26615a.disjointSubtrees_$s$wdisjointSubtrees |
| 668 | 667 | }
|
| 669 | 668 | }; } in
|
| 670 | 669 | jump $wlookupInArrayCont_
|
| 671 | - sc k0 sc3 0# (sizeofSmallArray# @Lifted @(Leaf k a) sc3)
|
|
| 672 | - }
|
|
| 670 | + sc kB sc3 0# (sizeofSmallArray# @Lifted @(Leaf k a) sc3)
|
|
| 673 | 671 | }
|
| 674 | 672 | };
|
| 675 | 673 | Collision bx bx1 ->
|
| ... | ... | @@ -710,7 +708,7 @@ T26615a.disjointSubtrees_$s$wdisjointSubtrees |
| 710 | 708 | end Rec }
|
| 711 | 709 | |
| 712 | 710 | Rec {
|
| 713 | --- RHS size: {terms: 719, types: 748, coercions: 18, joins: 13/23}
|
|
| 711 | +-- RHS size: {terms: 713, types: 746, coercions: 18, joins: 13/23}
|
|
| 714 | 712 | T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker]
|
| 715 | 713 | :: forall k a b. Eq k => Int# -> HashMap k a -> HashMap k b -> Bool
|
| 716 | 714 | [GblId[StrictWorker([~, ~, !])],
|
| ... | ... | @@ -740,7 +738,6 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker] |
| 740 | 738 | Empty -> GHC.Internal.Types.True;
|
| 741 | 739 | Leaf bx [Occ=Once1] ds2 [Occ=Once1!] ->
|
| 742 | 740 | case ds2 of { L kB [Occ=Once1] _ [Occ=Dead] ->
|
| 743 | - case kB of k0 [Occ=Once1] { __DEFAULT ->
|
|
| 744 | 741 | joinrec {
|
| 745 | 742 | lookupCont_ [Occ=LoopBreakerT[5]]
|
| 746 | 743 | :: Eq k => Word -> k -> Int -> HashMap k a -> Bool
|
| ... | ... | @@ -868,8 +865,7 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker] |
| 868 | 865 | }
|
| 869 | 866 | }; } in
|
| 870 | 867 | jump lookupCont_
|
| 871 | - $dEq (GHC.Internal.Types.W# bx) k0 (GHC.Internal.Types.I# ww) ds
|
|
| 872 | - }
|
|
| 868 | + $dEq (GHC.Internal.Types.W# bx) kB (GHC.Internal.Types.I# ww) ds
|
|
| 873 | 869 | };
|
| 874 | 870 | Collision _ [Occ=Dead] _ [Occ=Dead] ->
|
| 875 | 871 | T26615a.$wdisjointSubtrees @k @b @a $dEq ww wild ds
|
| ... | ... | @@ -880,7 +876,6 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker] |
| 880 | 876 | case ds1 of { L kA [Occ=Once2] _ [Occ=Dead] ->
|
| 881 | 877 | case _b of wild2 [Occ=Once1] {
|
| 882 | 878 | __DEFAULT ->
|
| 883 | - case kA of k0 [Occ=Once1] { __DEFAULT ->
|
|
| 884 | 879 | joinrec {
|
| 885 | 880 | lookupCont_ [Occ=LoopBreakerT[5]]
|
| 886 | 881 | :: Eq k => Word -> k -> Int -> HashMap k b -> Bool
|
| ... | ... | @@ -1004,8 +999,11 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker] |
| 1004 | 999 | }
|
| 1005 | 1000 | }; } in
|
| 1006 | 1001 | jump lookupCont_
|
| 1007 | - $dEq (GHC.Internal.Types.W# bx) k0 (GHC.Internal.Types.I# ww) wild2
|
|
| 1008 | - };
|
|
| 1002 | + $dEq
|
|
| 1003 | + (GHC.Internal.Types.W# bx)
|
|
| 1004 | + kA
|
|
| 1005 | + (GHC.Internal.Types.I# ww)
|
|
| 1006 | + wild2;
|
|
| 1009 | 1007 | Leaf bx1 [Occ=Once1] ds3 [Occ=Once1!] ->
|
| 1010 | 1008 | case ds3 of { L kB [Occ=Once1] _ [Occ=Dead] ->
|
| 1011 | 1009 | case GHC.Internal.Classes.neWord
|
| ... | ... | @@ -1091,13 +1089,14 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker] |
| 1091 | 1089 | [LclId[JoinId(1)(Nothing)], Arity=1, Str=<L>, Unf=OtherCon []]
|
| 1092 | 1090 | go (ds1 [Occ=Once1!] :: Word)
|
| 1093 | 1091 | = case ds1 of { W# ds2 [Occ=Once1!] ->
|
| 1094 | - case ds2 of ds3 {
|
|
| 1092 | + case ds2 of wild5 {
|
|
| 1095 | 1093 | __DEFAULT ->
|
| 1096 | 1094 | let {
|
| 1097 | 1095 | m :: Word#
|
| 1098 | 1096 | [LclId]
|
| 1099 | 1097 | m = and#
|
| 1100 | - ds3 (int2Word# (negateInt# (word2Int# ds3))) } in
|
|
| 1098 | + wild5
|
|
| 1099 | + (int2Word# (negateInt# (word2Int# wild5))) } in
|
|
| 1101 | 1100 | case indexSmallArray#
|
| 1102 | 1101 | @Lifted
|
| 1103 | 1102 | @(HashMap k a)
|
| ... | ... | @@ -1118,7 +1117,7 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker] |
| 1118 | 1117 | of {
|
| 1119 | 1118 | False -> GHC.Internal.Types.False;
|
| 1120 | 1119 | True ->
|
| 1121 | - jump go (GHC.Internal.Types.W# (and# ds3 (not# m)))
|
|
| 1120 | + jump go (GHC.Internal.Types.W# (and# wild5 (not# m)))
|
|
| 1122 | 1121 | }
|
| 1123 | 1122 | }
|
| 1124 | 1123 | };
|
| ... | ... | @@ -1137,12 +1136,12 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker] |
| 1137 | 1136 | [LclId[JoinId(1)(Nothing)], Arity=1, Str=<L>, Unf=OtherCon []]
|
| 1138 | 1137 | go (ds1 [Occ=Once1!] :: Word)
|
| 1139 | 1138 | = case ds1 of { W# ds2 [Occ=Once1!] ->
|
| 1140 | - case ds2 of ds3 {
|
|
| 1139 | + case ds2 of wild3 {
|
|
| 1141 | 1140 | __DEFAULT ->
|
| 1142 | 1141 | let {
|
| 1143 | 1142 | m :: Word#
|
| 1144 | 1143 | [LclId]
|
| 1145 | - m = and# ds3 (int2Word# (negateInt# (word2Int# ds3))) } in
|
|
| 1144 | + m = and# wild3 (int2Word# (negateInt# (word2Int# wild3))) } in
|
|
| 1146 | 1145 | case indexSmallArray#
|
| 1147 | 1146 | @Lifted
|
| 1148 | 1147 | @(HashMap k a)
|
| ... | ... | @@ -1161,7 +1160,7 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker] |
| 1161 | 1160 | case T26615a.$wdisjointSubtrees @k @a @b $dEq (+# ww 5#) ipv ipv1
|
| 1162 | 1161 | of {
|
| 1163 | 1162 | False -> GHC.Internal.Types.False;
|
| 1164 | - True -> jump go (GHC.Internal.Types.W# (and# ds3 (not# m)))
|
|
| 1163 | + True -> jump go (GHC.Internal.Types.W# (and# wild3 (not# m)))
|
|
| 1165 | 1164 | }
|
| 1166 | 1165 | }
|
| 1167 | 1166 | };
|
| ... | ... | @@ -1179,12 +1178,12 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker] |
| 1179 | 1178 | [LclId[JoinId(1)(Nothing)], Arity=1, Str=<L>, Unf=OtherCon []]
|
| 1180 | 1179 | go (ds1 [Occ=Once1!] :: Word)
|
| 1181 | 1180 | = case ds1 of { W# ds2 [Occ=Once1!] ->
|
| 1182 | - case ds2 of ds3 {
|
|
| 1181 | + case ds2 of wild3 {
|
|
| 1183 | 1182 | __DEFAULT ->
|
| 1184 | 1183 | let {
|
| 1185 | 1184 | m :: Word#
|
| 1186 | 1185 | [LclId]
|
| 1187 | - m = and# ds3 (int2Word# (negateInt# (word2Int# ds3))) } in
|
|
| 1186 | + m = and# wild3 (int2Word# (negateInt# (word2Int# wild3))) } in
|
|
| 1188 | 1187 | case indexSmallArray#
|
| 1189 | 1188 | @Lifted
|
| 1190 | 1189 | @(HashMap k a)
|
| ... | ... | @@ -1203,7 +1202,7 @@ T26615a.$wdisjointSubtrees [InlPrag=INLINABLE[2], Occ=LoopBreaker] |
| 1203 | 1202 | case T26615a.$wdisjointSubtrees @k @a @b $dEq (+# ww 5#) ipv ipv1
|
| 1204 | 1203 | of {
|
| 1205 | 1204 | False -> GHC.Internal.Types.False;
|
| 1206 | - True -> jump go (GHC.Internal.Types.W# (and# ds3 (not# m)))
|
|
| 1205 | + True -> jump go (GHC.Internal.Types.W# (and# wild3 (not# m)))
|
|
| 1207 | 1206 | }
|
| 1208 | 1207 | }
|
| 1209 | 1208 | };
|
| ... | ... | @@ -1277,7 +1276,6 @@ T26615a.$wdisjointSubtrees |
| 1277 | 1276 | Empty -> GHC.Internal.Types.True;
|
| 1278 | 1277 | Leaf bx ds2 ->
|
| 1279 | 1278 | case ds2 of { L kB ds3 ->
|
| 1280 | - case kB of k0 { __DEFAULT ->
|
|
| 1281 | 1279 | join {
|
| 1282 | 1280 | exit [Dmd=LC(S,C(1,C(1,C(1,L))))]
|
| 1283 | 1281 | :: Word# -> k -> Word# -> Leaf k a -> Bool
|
| ... | ... | @@ -1392,8 +1390,7 @@ T26615a.$wdisjointSubtrees |
| 1392 | 1390 | }
|
| 1393 | 1391 | }
|
| 1394 | 1392 | }; } in
|
| 1395 | - jump $wlookupCont_ $dEq bx k0 ww ds
|
|
| 1396 | - }
|
|
| 1393 | + jump $wlookupCont_ $dEq bx kB ww ds
|
|
| 1397 | 1394 | };
|
| 1398 | 1395 | Collision bx bx1 ->
|
| 1399 | 1396 | T26615a.disjointSubtrees_$s$wdisjointSubtrees
|
| ... | ... | @@ -1405,7 +1402,6 @@ T26615a.$wdisjointSubtrees |
| 1405 | 1402 | case ds1 of { L kA ds2 ->
|
| 1406 | 1403 | case _b of wild2 {
|
| 1407 | 1404 | __DEFAULT ->
|
| 1408 | - case kA of k0 { __DEFAULT ->
|
|
| 1409 | 1405 | join {
|
| 1410 | 1406 | exit [Dmd=LC(S,C(1,C(1,C(1,L))))]
|
| 1411 | 1407 | :: Word# -> k -> Word# -> Leaf k b -> Bool
|
| ... | ... | @@ -1519,8 +1515,7 @@ T26615a.$wdisjointSubtrees |
| 1519 | 1515 | }
|
| 1520 | 1516 | }
|
| 1521 | 1517 | }; } in
|
| 1522 | - jump $wlookupCont_ $dEq bx k0 ww wild2
|
|
| 1523 | - };
|
|
| 1518 | + jump $wlookupCont_ $dEq bx kA ww wild2;
|
|
| 1524 | 1519 | Leaf bx1 ds3 ->
|
| 1525 | 1520 | case ds3 of { L kB ds4 ->
|
| 1526 | 1521 | case neWord# bx bx1 of {
|
| ... | ... | @@ -1604,12 +1599,12 @@ T26615a.$wdisjointSubtrees |
| 1604 | 1599 | $wgo [InlPrag=[2], Occ=LoopBreaker, Dmd=SC(S,L)] :: Word# -> Bool
|
| 1605 | 1600 | [LclId[JoinId(1)(Nothing)], Arity=1, Str=<1L>, Unf=OtherCon []]
|
| 1606 | 1601 | $wgo (ww1 :: Word#)
|
| 1607 | - = case ww1 of ds1 {
|
|
| 1602 | + = case ww1 of wild4 {
|
|
| 1608 | 1603 | __DEFAULT ->
|
| 1609 | 1604 | let {
|
| 1610 | 1605 | m :: Word#
|
| 1611 | 1606 | [LclId]
|
| 1612 | - m = and# ds1 (int2Word# (negateInt# (word2Int# ds1))) } in
|
|
| 1607 | + m = and# wild4 (int2Word# (negateInt# (word2Int# wild4))) } in
|
|
| 1613 | 1608 | case indexSmallArray#
|
| 1614 | 1609 | @Lifted
|
| 1615 | 1610 | @(HashMap k a)
|
| ... | ... | @@ -1626,7 +1621,7 @@ T26615a.$wdisjointSubtrees |
| 1626 | 1621 | { (# ipv1 #) ->
|
| 1627 | 1622 | case T26615a.$wdisjointSubtrees @k @a @b $dEq lvl2 ipv ipv1 of {
|
| 1628 | 1623 | False -> GHC.Internal.Types.False;
|
| 1629 | - True -> jump $wgo (and# ds1 (not# m))
|
|
| 1624 | + True -> jump $wgo (and# wild4 (not# m))
|
|
| 1630 | 1625 | }
|
| 1631 | 1626 | }
|
| 1632 | 1627 | };
|
| ... | ... | @@ -1647,12 +1642,12 @@ T26615a.$wdisjointSubtrees |
| 1647 | 1642 | $wgo [InlPrag=[2], Occ=LoopBreaker, Dmd=SC(S,L)] :: Word# -> Bool
|
| 1648 | 1643 | [LclId[JoinId(1)(Nothing)], Arity=1, Str=<1L>, Unf=OtherCon []]
|
| 1649 | 1644 | $wgo (ww1 :: Word#)
|
| 1650 | - = case ww1 of ds1 {
|
|
| 1645 | + = case ww1 of wild2 {
|
|
| 1651 | 1646 | __DEFAULT ->
|
| 1652 | 1647 | let {
|
| 1653 | 1648 | m :: Word#
|
| 1654 | 1649 | [LclId]
|
| 1655 | - m = and# ds1 (int2Word# (negateInt# (word2Int# ds1))) } in
|
|
| 1650 | + m = and# wild2 (int2Word# (negateInt# (word2Int# wild2))) } in
|
|
| 1656 | 1651 | case indexSmallArray#
|
| 1657 | 1652 | @Lifted
|
| 1658 | 1653 | @(HashMap k a)
|
| ... | ... | @@ -1669,7 +1664,7 @@ T26615a.$wdisjointSubtrees |
| 1669 | 1664 | { (# ipv1 #) ->
|
| 1670 | 1665 | case T26615a.$wdisjointSubtrees @k @a @b $dEq lvl2 ipv ipv1 of {
|
| 1671 | 1666 | False -> GHC.Internal.Types.False;
|
| 1672 | - True -> jump $wgo (and# ds1 (not# m))
|
|
| 1667 | + True -> jump $wgo (and# wild2 (not# m))
|
|
| 1673 | 1668 | }
|
| 1674 | 1669 | }
|
| 1675 | 1670 | };
|
| ... | ... | @@ -1689,12 +1684,12 @@ T26615a.$wdisjointSubtrees |
| 1689 | 1684 | $wgo [InlPrag=[2], Occ=LoopBreaker, Dmd=SC(S,L)] :: Word# -> Bool
|
| 1690 | 1685 | [LclId[JoinId(1)(Nothing)], Arity=1, Str=<1L>, Unf=OtherCon []]
|
| 1691 | 1686 | $wgo (ww1 :: Word#)
|
| 1692 | - = case ww1 of ds1 {
|
|
| 1687 | + = case ww1 of wild2 {
|
|
| 1693 | 1688 | __DEFAULT ->
|
| 1694 | 1689 | let {
|
| 1695 | 1690 | m :: Word#
|
| 1696 | 1691 | [LclId]
|
| 1697 | - m = and# ds1 (int2Word# (negateInt# (word2Int# ds1))) } in
|
|
| 1692 | + m = and# wild2 (int2Word# (negateInt# (word2Int# wild2))) } in
|
|
| 1698 | 1693 | case indexSmallArray#
|
| 1699 | 1694 | @Lifted
|
| 1700 | 1695 | @(HashMap k a)
|
| ... | ... | @@ -1711,7 +1706,7 @@ T26615a.$wdisjointSubtrees |
| 1711 | 1706 | { (# ipv1 #) ->
|
| 1712 | 1707 | case T26615a.$wdisjointSubtrees @k @a @b $dEq lvl2 ipv ipv1 of {
|
| 1713 | 1708 | False -> GHC.Internal.Types.False;
|
| 1714 | - True -> jump $wgo (and# ds1 (not# m))
|
|
| 1709 | + True -> jump $wgo (and# wild2 (not# m))
|
|
| 1715 | 1710 | }
|
| 1716 | 1711 | }
|
| 1717 | 1712 | };
|
| ... | ... | @@ -1845,32 +1840,7 @@ disjointSubtrees |
| 1845 | 1840 | |
| 1846 | 1841 | ==================== Tidy Core ====================
|
| 1847 | 1842 | Result size of Tidy Core
|
| 1848 | - = {terms: 622, types: 674, coercions: 18, joins: 8/14}
|
|
| 1849 | - |
|
| 1850 | --- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
|
|
| 1851 | -$trModule1 :: GHC.Internal.Prim.Addr#
|
|
| 1852 | -[GblId, Unf=OtherCon []]
|
|
| 1853 | -$trModule1 = "T26615"#
|
|
| 1854 | - |
|
| 1855 | --- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
|
| 1856 | -$trModule2 :: GHC.Internal.Types.TrName
|
|
| 1857 | -[GblId, Unf=OtherCon []]
|
|
| 1858 | -$trModule2 = GHC.Internal.Types.TrNameS $trModule1
|
|
| 1859 | - |
|
| 1860 | --- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
|
|
| 1861 | -$trModule3 :: GHC.Internal.Prim.Addr#
|
|
| 1862 | -[GblId, Unf=OtherCon []]
|
|
| 1863 | -$trModule3 = "main"#
|
|
| 1864 | - |
|
| 1865 | --- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
|
|
| 1866 | -$trModule4 :: GHC.Internal.Types.TrName
|
|
| 1867 | -[GblId, Unf=OtherCon []]
|
|
| 1868 | -$trModule4 = GHC.Internal.Types.TrNameS $trModule3
|
|
| 1869 | - |
|
| 1870 | --- RHS size: {terms: 3, types: 0, coercions: 0, joins: 0/0}
|
|
| 1871 | -T26615.$trModule [InlPrag=[~]] :: GHC.Internal.Types.Module
|
|
| 1872 | -[GblId, Unf=OtherCon []]
|
|
| 1873 | -T26615.$trModule = GHC.Internal.Types.Module $trModule4 $trModule2
|
|
| 1843 | + = {terms: 603, types: 666, coercions: 18, joins: 8/14}
|
|
| 1874 | 1844 | |
| 1875 | 1845 | -- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
|
| 1876 | 1846 | lvl :: GHC.Internal.Prim.Addr#
|
| ... | ... | @@ -2029,7 +1999,7 @@ $wpoly_lookupCont_ |
| 2029 | 1999 | end Rec }
|
| 2030 | 2000 | |
| 2031 | 2001 | Rec {
|
| 2032 | --- RHS size: {terms: 450, types: 507, coercions: 18, joins: 8/13}
|
|
| 2002 | +-- RHS size: {terms: 445, types: 504, coercions: 18, joins: 8/13}
|
|
| 2033 | 2003 | T26615.$s$wdisjointSubtrees [InlPrag=[~], Occ=LoopBreaker]
|
| 2034 | 2004 | :: forall a b.
|
| 2035 | 2005 | GHC.Internal.Prim.Int#
|
| ... | ... | @@ -2067,11 +2037,7 @@ T26615.$s$wdisjointSubtrees |
| 2067 | 2037 | T26615a.Leaf bx1 ds3 ->
|
| 2068 | 2038 | case ds3 of { T26615a.L kB ds4 ->
|
| 2069 | 2039 | case GHC.Internal.Prim.neWord# bx bx1 of {
|
| 2070 | - __DEFAULT ->
|
|
| 2071 | - case GHC.Internal.Classes.$fEqList_$s$c==1 kA kB of {
|
|
| 2072 | - False -> GHC.Internal.Types.True;
|
|
| 2073 | - True -> GHC.Internal.Types.False
|
|
| 2074 | - };
|
|
| 2040 | + __DEFAULT -> GHC.Internal.Classes.$fEqList_$s$c/=1 kA kB;
|
|
| 2075 | 2041 | 1# -> GHC.Internal.Types.True
|
| 2076 | 2042 | }
|
| 2077 | 2043 | }
|
| ... | ... | @@ -2094,14 +2060,14 @@ T26615.$s$wdisjointSubtrees |
| 2094 | 2060 | $s$wfoldr_ [InlPrag=[2],
|
| 2095 | 2061 | Occ=LoopBreaker,
|
| 2096 | 2062 | Dmd=SC(S,C(1,C(1,C(1,L))))]
|
| 2097 | - :: GHC.Internal.Prim.SmallArray# (T26615a.Leaf [Char] a)
|
|
| 2063 | + :: GHC.Internal.Prim.SmallArray# (T26615a.Leaf String a)
|
|
| 2098 | 2064 | -> GHC.Internal.Prim.Int# -> GHC.Internal.Prim.Int# -> Bool -> Bool
|
| 2099 | 2065 | [LclId[JoinId(4)(Nothing)],
|
| 2100 | 2066 | Arity=4,
|
| 2101 | 2067 | Str=<L><L><L><L>,
|
| 2102 | 2068 | Unf=OtherCon []]
|
| 2103 | 2069 | $s$wfoldr_ (sc
|
| 2104 | - :: GHC.Internal.Prim.SmallArray# (T26615a.Leaf [Char] a))
|
|
| 2070 | + :: GHC.Internal.Prim.SmallArray# (T26615a.Leaf String a))
|
|
| 2105 | 2071 | (sc1 :: GHC.Internal.Prim.Int#)
|
| 2106 | 2072 | (sc2 :: GHC.Internal.Prim.Int#)
|
| 2107 | 2073 | (sc3 :: Bool)
|
| ... | ... | @@ -2243,16 +2209,16 @@ T26615.$s$wdisjointSubtrees |
| 2243 | 2209 | :: GHC.Internal.Prim.Word# -> Bool
|
| 2244 | 2210 | [LclId[JoinId(1)(Nothing)], Arity=1, Str=<1L>, Unf=OtherCon []]
|
| 2245 | 2211 | $wgo (ww1 :: GHC.Internal.Prim.Word#)
|
| 2246 | - = case ww1 of ds3 {
|
|
| 2212 | + = case ww1 of wild5 {
|
|
| 2247 | 2213 | __DEFAULT ->
|
| 2248 | 2214 | let {
|
| 2249 | 2215 | m :: GHC.Internal.Prim.Word#
|
| 2250 | 2216 | [LclId]
|
| 2251 | 2217 | m = GHC.Internal.Prim.and#
|
| 2252 | - ds3
|
|
| 2218 | + wild5
|
|
| 2253 | 2219 | (GHC.Internal.Prim.int2Word#
|
| 2254 | 2220 | (GHC.Internal.Prim.negateInt#
|
| 2255 | - (GHC.Internal.Prim.word2Int# ds3))) } in
|
|
| 2221 | + (GHC.Internal.Prim.word2Int# wild5))) } in
|
|
| 2256 | 2222 | case GHC.Internal.Prim.indexSmallArray#
|
| 2257 | 2223 | @GHC.Internal.Types.Lifted
|
| 2258 | 2224 | @(HashMap String a)
|
| ... | ... | @@ -2279,7 +2245,7 @@ T26615.$s$wdisjointSubtrees |
| 2279 | 2245 | False -> GHC.Internal.Types.False;
|
| 2280 | 2246 | True ->
|
| 2281 | 2247 | jump $wgo
|
| 2282 | - (GHC.Internal.Prim.and# ds3 (GHC.Internal.Prim.not# m))
|
|
| 2248 | + (GHC.Internal.Prim.and# wild5 (GHC.Internal.Prim.not# m))
|
|
| 2283 | 2249 | }
|
| 2284 | 2250 | }
|
| 2285 | 2251 | };
|
| ... | ... | @@ -2297,16 +2263,16 @@ T26615.$s$wdisjointSubtrees |
| 2297 | 2263 | :: GHC.Internal.Prim.Word# -> Bool
|
| 2298 | 2264 | [LclId[JoinId(1)(Nothing)], Arity=1, Str=<1L>, Unf=OtherCon []]
|
| 2299 | 2265 | $wgo (ww1 :: GHC.Internal.Prim.Word#)
|
| 2300 | - = case ww1 of ds3 {
|
|
| 2266 | + = case ww1 of wild3 {
|
|
| 2301 | 2267 | __DEFAULT ->
|
| 2302 | 2268 | let {
|
| 2303 | 2269 | m :: GHC.Internal.Prim.Word#
|
| 2304 | 2270 | [LclId]
|
| 2305 | 2271 | m = GHC.Internal.Prim.and#
|
| 2306 | - ds3
|
|
| 2272 | + wild3
|
|
| 2307 | 2273 | (GHC.Internal.Prim.int2Word#
|
| 2308 | 2274 | (GHC.Internal.Prim.negateInt#
|
| 2309 | - (GHC.Internal.Prim.word2Int# ds3))) } in
|
|
| 2275 | + (GHC.Internal.Prim.word2Int# wild3))) } in
|
|
| 2310 | 2276 | case GHC.Internal.Prim.indexSmallArray#
|
| 2311 | 2277 | @GHC.Internal.Types.Lifted
|
| 2312 | 2278 | @(HashMap String a)
|
| ... | ... | @@ -2332,7 +2298,7 @@ T26615.$s$wdisjointSubtrees |
| 2332 | 2298 | of {
|
| 2333 | 2299 | False -> GHC.Internal.Types.False;
|
| 2334 | 2300 | True ->
|
| 2335 | - jump $wgo (GHC.Internal.Prim.and# ds3 (GHC.Internal.Prim.not# m))
|
|
| 2301 | + jump $wgo (GHC.Internal.Prim.and# wild3 (GHC.Internal.Prim.not# m))
|
|
| 2336 | 2302 | }
|
| 2337 | 2303 | }
|
| 2338 | 2304 | };
|
| ... | ... | @@ -2349,16 +2315,16 @@ T26615.$s$wdisjointSubtrees |
| 2349 | 2315 | :: GHC.Internal.Prim.Word# -> Bool
|
| 2350 | 2316 | [LclId[JoinId(1)(Nothing)], Arity=1, Str=<1L>, Unf=OtherCon []]
|
| 2351 | 2317 | $wgo (ww1 :: GHC.Internal.Prim.Word#)
|
| 2352 | - = case ww1 of ds3 {
|
|
| 2318 | + = case ww1 of wild3 {
|
|
| 2353 | 2319 | __DEFAULT ->
|
| 2354 | 2320 | let {
|
| 2355 | 2321 | m :: GHC.Internal.Prim.Word#
|
| 2356 | 2322 | [LclId]
|
| 2357 | 2323 | m = GHC.Internal.Prim.and#
|
| 2358 | - ds3
|
|
| 2324 | + wild3
|
|
| 2359 | 2325 | (GHC.Internal.Prim.int2Word#
|
| 2360 | 2326 | (GHC.Internal.Prim.negateInt#
|
| 2361 | - (GHC.Internal.Prim.word2Int# ds3))) } in
|
|
| 2327 | + (GHC.Internal.Prim.word2Int# wild3))) } in
|
|
| 2362 | 2328 | case GHC.Internal.Prim.indexSmallArray#
|
| 2363 | 2329 | @GHC.Internal.Types.Lifted
|
| 2364 | 2330 | @(HashMap String a)
|
| ... | ... | @@ -2384,7 +2350,7 @@ T26615.$s$wdisjointSubtrees |
| 2384 | 2350 | of {
|
| 2385 | 2351 | False -> GHC.Internal.Types.False;
|
| 2386 | 2352 | True ->
|
| 2387 | - jump $wgo (GHC.Internal.Prim.and# ds3 (GHC.Internal.Prim.not# m))
|
|
| 2353 | + jump $wgo (GHC.Internal.Prim.and# wild3 (GHC.Internal.Prim.not# m))
|
|
| 2388 | 2354 | }
|
| 2389 | 2355 | }
|
| 2390 | 2356 | };
|
| ... | ... | @@ -602,6 +602,7 @@ test('T26615', [grep_errmsg(r'fEqList')], multimod_compile, ['T26615', '-O -fsp |
| 602 | 602 | # T26722: there should be no reboxing in $wg
|
| 603 | 603 | test('T26722', [grep_errmsg(r'SPEC')], compile, ['-O -dno-typeable-binds'])
|
| 604 | 604 | |
| 605 | +test('T26548', normal, compile, ['-O -ddump-simpl -dsuppress-uniques -dno-typeable-binds'])
|
|
| 605 | 606 | test('T26805', [grep_errmsg(r'fromInteger')], compile, ['-O -dno-typeable-binds -ddump-simpl -dsuppress-uniques'])
|
| 606 | 607 | test('T26826', normal, compile, ['-O'])
|
| 607 | 608 | test('T26903', [grep_errmsg(r'reverse')], compile, ['-O -dno-typeable-binds -ddump-simpl -dsuppress-uniques -dsuppress-all'])
|