Commit fe04f378 authored by Joachim Breitner's avatar Joachim Breitner

Allow CSE'ing of work-wrapped bindings (#14186)

the worker/wrapper creates an artificial INLINE pragma, which caused CSE
to not do its work. We now recognize such artificial pragmas by using
`NoUserInline` instead of `Inline` as the `InlineSpec`.

Differential Revision: https://phabricator.haskell.org/D3939
parent fe35b85a
......@@ -85,7 +85,7 @@ module BasicTypes(
isNeverActive, isAlwaysActive, isEarlyActive,
RuleMatchInfo(..), isConLike, isFunLike,
InlineSpec(..), isEmptyInlineSpec,
InlineSpec(..), noUserInlineSpec,
InlinePragma(..), defaultInlinePragma, alwaysInlinePragma,
neverInlinePragma, dfunInlinePragma,
isDefaultInlinePragma,
......@@ -1221,8 +1221,8 @@ data InlineSpec -- What the user's INLINE pragma looked like
= Inline
| Inlinable
| NoInline
| EmptyInlineSpec -- Used in a place-holder InlinePragma in SpecPrag or IdInfo,
-- where there isn't any real inline pragma at all
| NoUserInline -- Used when the pragma did not come from the user,
-- e.g. in `defaultInlinePragma` or when created by CSE
deriving( Eq, Data, Show )
-- Show needed for Lexer.x
......@@ -1232,7 +1232,7 @@ This data type mirrors what you can write in an INLINE or NOINLINE pragma in
the source program.
If you write nothing at all, you get defaultInlinePragma:
inl_inline = EmptyInlineSpec
inl_inline = NoUserInline
inl_act = AlwaysActive
inl_rule = FunLike
......@@ -1305,16 +1305,16 @@ isFunLike :: RuleMatchInfo -> Bool
isFunLike FunLike = True
isFunLike _ = False
isEmptyInlineSpec :: InlineSpec -> Bool
isEmptyInlineSpec EmptyInlineSpec = True
isEmptyInlineSpec _ = False
noUserInlineSpec :: InlineSpec -> Bool
noUserInlineSpec NoUserInline = True
noUserInlineSpec _ = False
defaultInlinePragma, alwaysInlinePragma, neverInlinePragma, dfunInlinePragma
:: InlinePragma
defaultInlinePragma = InlinePragma { inl_src = SourceText "{-# INLINE"
, inl_act = AlwaysActive
, inl_rule = FunLike
, inl_inline = EmptyInlineSpec
, inl_inline = NoUserInline
, inl_sat = Nothing }
alwaysInlinePragma = defaultInlinePragma { inl_inline = Inline }
......@@ -1334,7 +1334,7 @@ isDefaultInlinePragma :: InlinePragma -> Bool
isDefaultInlinePragma (InlinePragma { inl_act = activation
, inl_rule = match_info
, inl_inline = inline })
= isEmptyInlineSpec inline && isAlwaysActive activation && isFunLike match_info
= noUserInlineSpec inline && isAlwaysActive activation && isFunLike match_info
isInlinePragma :: InlinePragma -> Bool
isInlinePragma prag = case inl_inline prag of
......@@ -1379,10 +1379,10 @@ instance Outputable RuleMatchInfo where
ppr FunLike = text "FUNLIKE"
instance Outputable InlineSpec where
ppr Inline = text "INLINE"
ppr NoInline = text "NOINLINE"
ppr Inlinable = text "INLINABLE"
ppr EmptyInlineSpec = empty
ppr Inline = text "INLINE"
ppr NoInline = text "NOINLINE"
ppr Inlinable = text "INLINABLE"
ppr NoUserInline = text "NOUSERINLINE" -- what is better?
instance Outputable InlinePragma where
ppr = pprInline
......
......@@ -362,10 +362,10 @@ makeCorePair dflags gbl_id is_default_method dict_arity rhs
| otherwise
= case inlinePragmaSpec inline_prag of
EmptyInlineSpec -> (gbl_id, rhs)
NoInline -> (gbl_id, rhs)
Inlinable -> (gbl_id `setIdUnfolding` inlinable_unf, rhs)
Inline -> inline_pair
NoUserInline -> (gbl_id, rhs)
NoInline -> (gbl_id, rhs)
Inlinable -> (gbl_id `setIdUnfolding` inlinable_unf, rhs)
Inline -> inline_pair
where
inline_prag = idInlinePragma gbl_id
......
......@@ -805,7 +805,7 @@ rep_specialise nm ty ispec loc
; ty1 <- repHsSigType ty
; phases <- repPhases $ inl_act ispec
; let inline = inl_inline ispec
; pragma <- if isEmptyInlineSpec inline
; pragma <- if noUserInlineSpec inline
then -- SPECIALISE
repPragSpec nm1 ty1 phases
else -- SPECIALISE INLINE
......
......@@ -660,7 +660,7 @@ cvtPragmaD (SpecialiseP nm ty inline phases)
; let (inline', dflt,srcText) = case inline of
Just inline1 -> (cvtInline inline1, dfltActivation inline1,
src inline1)
Nothing -> (EmptyInlineSpec, AlwaysActive,
Nothing -> (NoUserInline, AlwaysActive,
"{-# SPECIALISE")
; let ip = InlinePragma { inl_src = SourceText srcText
, inl_inline = inline'
......
......@@ -1069,8 +1069,8 @@ ppr_sig (SpecSig var ty inl@(InlinePragma { inl_inline = spec }))
(interpp'SP ty) inl)
where
pragmaSrc = case spec of
EmptyInlineSpec -> "{-# SPECIALISE"
_ -> "{-# SPECIALISE_INLINE"
NoUserInline -> "{-# SPECIALISE"
_ -> "{-# SPECIALISE_INLINE"
ppr_sig (InlineSig var inl)
= pragSrcBrackets (inl_src inl) "{-# INLINE" (pprInline inl
<+> pprPrefixOcc (unLoc var))
......
......@@ -2311,7 +2311,7 @@ sigdecl :: { LHsDecl GhcPs }
| '{-# SPECIALISE' activation qvar '::' sigtypes1 '#-}'
{% ams (
let inl_prag = mkInlinePragma (getSPEC_PRAGs $1)
(EmptyInlineSpec, FunLike) (snd $2)
(NoUserInline, FunLike) (snd $2)
in sLL $1 $> $ SigD (SpecSig $3 (fromOL $5) inl_prag))
(mo $1:mu AnnDcolon $4:mc $6:(fst $2)) }
......
......@@ -24,7 +24,8 @@ import Type ( tyConAppArgs )
import CoreSyn
import Outputable
import BasicTypes ( TopLevelFlag(..), isTopLevel
, isAlwaysActive, isAnyInlinePragma )
, isAlwaysActive, isAnyInlinePragma,
inlinePragmaSpec, noUserInlineSpec )
import TrieMap
import Util ( filterOut )
import Data.List ( mapAccumL )
......@@ -205,6 +206,10 @@ is small). The conclusion here is this:
might replace <rhs> by 'bar', and then later be unable to see that it
really was <rhs>.
An except to the rule is when the INLINE pragma is not from the user, e.g. from
WorkWrap (see Note [Wrapper activation]). We can tell because noUserInlineSpec
is then true.
Note that we do not (currently) do CSE on the unfolding stored inside
an Id, even if is a 'stable' unfolding. That means that when an
unfolding happens, it is always faithful to what the stable unfolding
......@@ -386,7 +391,8 @@ addBinding env in_id out_id rhs'
_ -> False
noCSE :: InId -> Bool
noCSE id = not (isAlwaysActive (idInlineActivation id))
noCSE id = not (isAlwaysActive (idInlineActivation id)) &&
not (noUserInlineSpec (inlinePragmaSpec (idInlinePragma id)))
-- See Note [CSE for INLINE and NOINLINE]
|| isAnyInlinePragma (idInlinePragma id)
-- See Note [CSE for stable unfoldings]
......
......@@ -1341,7 +1341,7 @@ specCalls mb_mod env existing_rules calls_for_me fn rhs
-- See Note [Specialising imported functions] in OccurAnal
| InlinePragma { inl_inline = Inlinable } <- inl_prag
= (inl_prag { inl_inline = EmptyInlineSpec }, noUnfolding)
= (inl_prag { inl_inline = NoUserInline }, noUnfolding)
| otherwise
= (inl_prag, specUnfolding poly_tyvars spec_app
......
......@@ -374,6 +374,10 @@ it appears in the first place in the defining module.
At one stage I tried making the wrapper inlining always-active, and
that had a very bad effect on nofib/imaginary/x2n1; a wrapper was
inlined before the specialisation fired.
The use an inl_inline of NoUserInline to distinguish this pragma from one
that was given by the user. In particular, CSE will not happen if there is a
user-specified pragma, but should happen for w/w’ed things (#14186).
-}
tryWW :: DynFlags
......@@ -521,7 +525,7 @@ splitFun dflags fam_envs fn_id fn_info wrap_dmds res_info rhs
wrap_act = ActiveAfter NoSourceText 0
wrap_rhs = wrap_fn work_id
wrap_prag = InlinePragma { inl_src = SourceText "{-# INLINE"
, inl_inline = Inline
, inl_inline = NoUserInline
, inl_sat = Nothing
, inl_act = wrap_act
, inl_rule = rule_match_info }
......
......@@ -540,7 +540,7 @@ addInlinePrags poly_id prags_for_me
warn_multiple_inlines inl1@(L loc prag1) (inl2@(L _ prag2) : inls)
| inlinePragmaActivation prag1 == inlinePragmaActivation prag2
, isEmptyInlineSpec (inlinePragmaSpec prag1)
, noUserInlineSpec (inlinePragmaSpec prag1)
= -- Tiresome: inl1 is put there by virtue of being in a hs-boot loop
-- and inl2 is a user NOINLINE pragma; we don't want to complain
warn_multiple_inlines inl2 inls
......
......@@ -1031,14 +1031,14 @@ instance Binary RuleMatchInfo where
else return FunLike
instance Binary InlineSpec where
put_ bh EmptyInlineSpec = putByte bh 0
put_ bh NoUserInline = putByte bh 0
put_ bh Inline = putByte bh 1
put_ bh Inlinable = putByte bh 2
put_ bh NoInline = putByte bh 3
get bh = do h <- getByte bh
case h of
0 -> return EmptyInlineSpec
0 -> return NoUserInline
1 -> return Inline
2 -> return Inlinable
_ -> return NoInline
......
......@@ -22,7 +22,7 @@ TYPE CONSTRUCTORS
COERCION AXIOMS
Dependent modules: []
Dependent packages: [base-4.10.0.0, ghc-prim-0.5.1.0,
integer-gmp-1.0.0.1]
integer-gmp-1.0.1.0]
==================== Typechecker ====================
Roles1.$tcT7
......@@ -137,36 +137,37 @@ Roles1.$tc'K1
(GHC.Types.TrNameS "'K1"#)
1
$krep
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 1
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 1
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 2
$krep [InlPrag=[~]] = GHC.Types.KindRepApp $krep $krep
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepVar 1
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepVar 1
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepVar 2
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepApp $krep $krep
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepFun $krep GHC.Types.krep$*Arr*
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep GHC.Types.krep$*
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepFun $krep GHC.Types.krep$*
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepFun GHC.Types.krep$*Arr* GHC.Types.krep$*Arr*
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp
Roles1.$tcT7 ((:) $krep ((:) $krep ((:) $krep [])))
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles1.$tcT6 ((:) $krep ((:) $krep []))
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles1.$tcT4 ((:) $krep ((:) $krep []))
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles1.$tcT3 ((:) $krep ((:) $krep []))
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles1.$tcT5 ((:) $krep [])
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles1.$tcT2 ((:) $krep [])
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles1.$tcT1 ((:) $krep [])
Roles1.$trModule
= GHC.Types.Module
......
......@@ -9,7 +9,7 @@ COERCION AXIOMS
axiom Roles12.N:C2 :: C2 a = a -> a -- Defined at Roles14.hs:6:1
Dependent modules: []
Dependent packages: [base-4.10.0.0, ghc-prim-0.5.1.0,
integer-gmp-1.0.0.1]
integer-gmp-1.0.1.0]
==================== Typechecker ====================
Roles12.$tcC2
......@@ -28,13 +28,14 @@ Roles12.$tc'C:C2
(GHC.Types.TrNameS "'C:C2"#)
1
$krep
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun GHC.Types.krep$* $krep
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepFun GHC.Types.krep$* $krep
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp GHC.Types.$tcConstraint []
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles12.$tcC2 ((:) $krep [])
Roles12.$trModule
= GHC.Types.Module
......
......@@ -8,7 +8,7 @@ TYPE CONSTRUCTORS
COERCION AXIOMS
Dependent modules: []
Dependent packages: [base-4.10.0.0, ghc-prim-0.5.1.0,
integer-gmp-1.0.0.1]
integer-gmp-1.0.1.0]
==================== Typechecker ====================
Roles2.$tcT2
......@@ -43,16 +43,16 @@ Roles2.$tc'K1
(GHC.Types.TrNameS "'K1"#)
1
$krep
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp GHC.Ptr.$tcFunPtr ((:) $krep [])
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles2.$tcT2 ((:) $krep [])
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp GHC.Types.$tcIO ((:) $krep [])
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles2.$tcT1 ((:) $krep [])
Roles2.$trModule
= GHC.Types.Module
......
......@@ -30,7 +30,7 @@ COERCION AXIOMS
C4 a b = a -> F4 b -> F4 b -- Defined at Roles3.hs:18:1
Dependent modules: []
Dependent packages: [base-4.10.0.0, ghc-prim-0.5.1.0,
integer-gmp-1.0.0.1]
integer-gmp-1.0.1.0]
==================== Typechecker ====================
Roles3.$tcC4
......@@ -81,24 +81,26 @@ Roles3.$tc'C:C1
(GHC.Types.TrNameS "'C:C1"#)
1
$krep
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 1
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun GHC.Types.krep$* $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun GHC.Types.krep$* $krep
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepVar 1
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepFun GHC.Types.krep$* $krep
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepFun GHC.Types.krep$* $krep
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp GHC.Types.$tcConstraint []
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp
Data.Type.Equality.$tc~
((:) GHC.Types.krep$* ((:) $krep ((:) $krep [])))
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles3.$tcC2 ((:) $krep ((:) $krep []))
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles3.$tcC1 ((:) $krep [])
Roles3.$trModule
= GHC.Types.Module
......
......@@ -15,7 +15,7 @@ COERCION AXIOMS
C3 a = a -> Syn1 a -- Defined at Roles4.hs:11:1
Dependent modules: []
Dependent packages: [base-4.10.0.0, ghc-prim-0.5.1.0,
integer-gmp-1.0.0.1]
integer-gmp-1.0.1.0]
==================== Typechecker ====================
Roles4.$tcC3
......@@ -50,19 +50,20 @@ Roles4.$tc'C:C1
(GHC.Types.TrNameS "'C:C1"#)
1
$krep
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun GHC.Types.krep$* $krep
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepFun GHC.Types.krep$* $krep
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp GHC.Types.$tc[] ((:) $krep [])
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp GHC.Types.$tcConstraint []
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles4.$tcC3 ((:) $krep [])
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp Roles4.$tcC1 ((:) $krep [])
Roles4.$trModule
= GHC.Types.Module
......
......@@ -17,7 +17,7 @@ INSTANCES
instance [incoherent] Nominal a -- Defined at T8958.hs:7:10
Dependent modules: []
Dependent packages: [base-4.10.0.0, ghc-prim-0.5.1.0,
integer-gmp-1.0.0.1]
integer-gmp-1.0.1.0]
==================== Typechecker ====================
T8958.$tcMap
......@@ -68,32 +68,33 @@ T8958.$tc'C:Nominal
(GHC.Types.TrNameS "'C:Nominal"#)
1
$krep
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=[~]] = GHC.Types.KindRepVar 1
$krep [InlPrag=[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=[~]] = GHC.Types.KindRepFun GHC.Types.krep$* $krep
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepVar 0
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepVar 1
$krep [InlPrag=NOUSERINLINE[~]] = GHC.Types.KindRepFun $krep $krep
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepFun GHC.Types.krep$* $krep
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp
GHC.Tuple.$tc(,)
((:) @ GHC.Types.KindRep
$krep ((:) @ GHC.Types.KindRep $krep [] @ GHC.Types.KindRep))
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp
T8958.$tcMap
((:) @ GHC.Types.KindRep
$krep ((:) @ GHC.Types.KindRep $krep [] @ GHC.Types.KindRep))
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp
GHC.Types.$tc[]
((:) @ GHC.Types.KindRep $krep [] @ GHC.Types.KindRep)
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp
GHC.Types.$tcConstraint [] @ GHC.Types.KindRep
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp
T8958.$tcRepresentational
((:) @ GHC.Types.KindRep $krep [] @ GHC.Types.KindRep)
$krep [InlPrag=[~]]
$krep [InlPrag=NOUSERINLINE[~]]
= GHC.Types.KindRepTyConApp
T8958.$tcNominal
((:) @ GHC.Types.KindRep $krep [] @ GHC.Types.KindRep)
......@@ -103,7 +104,7 @@ T8958.$trModule
AbsBinds [a] []
{Exports: [T8958.$fRepresentationala <= $dRepresentational
wrap: <>]
Exported types: T8958.$fRepresentationala [InlPrag=CONLIKE]
Exported types: T8958.$fRepresentationala [InlPrag=NOUSERINLINE CONLIKE]
:: forall a. Representational a
[LclIdX[DFunId],
Unf=DFun: \ (@ a) -> T8958.C:Representational TYPE: a]
......@@ -112,7 +113,7 @@ AbsBinds [a] []
AbsBinds [a] []
{Exports: [T8958.$fNominala <= $dNominal
wrap: <>]
Exported types: T8958.$fNominala [InlPrag=CONLIKE]
Exported types: T8958.$fNominala [InlPrag=NOUSERINLINE CONLIKE]
:: forall a. Nominal a
[LclIdX[DFunId], Unf=DFun: \ (@ a) -> T8958.C:Nominal TYPE: a]
Binds: $dNominal = T8958.C:Nominal @ a
......
......@@ -12,7 +12,7 @@ T13143.$wf = \ (@ a) _ [Occ=Dead] -> T13143.$wf @ a GHC.Prim.void#
end Rec }
-- RHS size: {terms: 4, types: 4, coercions: 0, joins: 0/0}
f [InlPrag=INLINE[0]] :: forall a. Int -> a
f [InlPrag=NOUSERINLINE[0]] :: forall a. Int -> a
[GblId,
Arity=1,
Caf=NoCafRefs,
......@@ -74,7 +74,7 @@ lvl = T13143.$wf @ Int GHC.Prim.void#
Rec {
-- RHS size: {terms: 28, types: 7, coercions: 0, joins: 0/0}
T13143.$wg [InlPrag=[0], Occ=LoopBreaker]
T13143.$wg [InlPrag=NOUSERINLINE[0], Occ=LoopBreaker]
:: Bool -> Bool -> GHC.Prim.Int# -> GHC.Prim.Int#
[GblId, Arity=3, Str=<S,1*U><S,1*U><S,U>]
T13143.$wg
......@@ -94,7 +94,7 @@ T13143.$wg
end Rec }
-- RHS size: {terms: 14, types: 6, coercions: 0, joins: 0/0}
g [InlPrag=INLINE[0]] :: Bool -> Bool -> Int -> Int
g [InlPrag=NOUSERINLINE[0]] :: Bool -> Bool -> Int -> Int
[GblId,
Arity=3,
Str=<S,1*U><S,1*U><S(S),1*U(U)>m,
......
==================== Tidy Core ====================
Result size of Tidy Core
= {terms: 52, types: 99, coercions: 0, joins: 0/0}
= {terms: 36, types: 68, coercions: 0, joins: 0/0}
-- RHS size: {terms: 18, types: 29, coercions: 0, joins: 0/0}
foo
-- RHS size: {terms: 19, types: 27, coercions: 0, joins: 0/0}
foo [InlPrag=[0]]
:: forall t1 b t2.
(t1 -> b) -> (t2 -> t1) -> (t2, [t2]) -> (b, [b])
[GblId, Arity=3]
[GblId,
Arity=3,
Caf=NoCafRefs,
Str=<L,C(U)><L,C(U)><S,1*U(U,1*U)>m,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=3,unsat_ok=True,boring_ok=False)
Tmpl= \ (@ t_sZi)
(@ b_sZj)
(@ t1_sZk)
(w_sZl :: t_sZi -> b_sZj)
(w1_sZm :: t1_sZk -> t_sZi)
(w2_sZn [Occ=Once!] :: (t1_sZk, [t1_sZk])) ->
case w2_sZn of { (ww1_sZq [Occ=Once], ww2_sZr [Occ=Once]) ->
(w_sZl (w1_sZm ww1_sZq),
map
@ t1_sZk
@ b_sZj
(\ (x_aXa [Occ=Once] :: t1_sZk) -> w_sZl (w1_sZm x_aXa))
ww2_sZr)
}}]
foo
= \ (@ t_aUk)
(@ b_aUs)
(@ t1_aUo)
(f_apH :: t_aUk -> b_aUs)
(g_apI :: t1_aUo -> t_aUk)
(ds_dVH :: (t1_aUo, [t1_aUo])) ->
case ds_dVH of { (x_apJ, xs_apK) ->
(f_apH (g_apI x_apJ),
= \ (@ t_sZi)
(@ b_sZj)
(@ t1_sZk)
(w_sZl :: t_sZi -> b_sZj)
(w1_sZm :: t1_sZk -> t_sZi)
(w2_sZn :: (t1_sZk, [t1_sZk])) ->
case w2_sZn of { (ww1_sZq, ww2_sZr) ->
(w_sZl (w1_sZm ww1_sZq),
map
@ t1_aUo @ b_aUs (. @ t_aUk @ b_aUs @ t1_aUo f_apH g_apI) xs_apK)
@ t1_sZk
@ b_sZj
(\ (x_aXa :: t1_sZk) -> w_sZl (w1_sZm x_aXa))
ww2_sZr)
}
-- RHS size: {terms: 18, types: 29, coercions: 0, joins: 0/0}
bar
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
bar [InlPrag=[0]]
:: forall t1 b t2.
(t1 -> b) -> (t2 -> t1) -> (t2, [t2]) -> (b, [b])
[GblId, Arity=3]
[GblId,
Arity=3,
Caf=NoCafRefs,
Str=<L,C(U)><L,C(U)><S,1*U(U,1*U)>m,
Unf=Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=3,unsat_ok=True,boring_ok=False)
Tmpl= \ (@ t_sZx)
(@ b_sZy)
(@ t1_sZz)
(w_sZA :: t_sZx -> b_sZy)
(w1_sZB :: t1_sZz -> t_sZx)
(w2_sZC [Occ=Once!] :: (t1_sZz, [t1_sZz])) ->
case w2_sZC of { (ww1_sZF [Occ=Once], ww2_sZG [Occ=Once]) ->
(w_sZA (w1_sZB ww1_sZF),
map
@ t1_sZz
@ b_sZy
(\ (x_aXa [Occ=Once] :: t1_sZz) -> w_sZA (w1_sZB x_aXa))
ww2_sZG)
}}]
bar = foo
-- RHS size: {terms: 1, types: 0, coercions: 0, joins: 0/0}
$trModule1_rVy :: GHC.Prim.Addr#
[GblId, Caf=NoCafRefs]
$trModule1_rVy = "main"#
T14186.$trModule4 :: GHC.Prim.Addr#
[GblId,
Caf=NoCafRefs,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True, Guidance=IF_ARGS [] 20 0}]
T14186.$trModule4 = "main"#
-- RHS size: {terms: 2, types: 0, coercions: 0, joins: 0/0}
$trModule2_rVX :: GHC.Types.TrName
[GblId, Caf=NoCafRefs]
$trModule2_rVX = GHC.Types.TrNameS $trModule1_rVy
T14186.$trModule3 :: GHC.Types.TrName
[GblId,
Caf=NoCafRefs,
Str=m1,