diff options
-rw-r--r-- | compiler/basicTypes/BasicTypes.hs | 10 | ||||
-rw-r--r-- | compiler/basicTypes/MkId.hs | 2 | ||||
-rw-r--r-- | compiler/specialise/Rules.hs | 12 | ||||
-rw-r--r-- | compiler/stranal/WorkWrap.hs | 4 |
4 files changed, 19 insertions, 9 deletions
diff --git a/compiler/basicTypes/BasicTypes.hs b/compiler/basicTypes/BasicTypes.hs index ce4696293c..151a040393 100644 --- a/compiler/basicTypes/BasicTypes.hs +++ b/compiler/basicTypes/BasicTypes.hs @@ -81,6 +81,7 @@ module BasicTypes( Activation(..), isActive, isActiveIn, competesWith, isNeverActive, isAlwaysActive, isEarlyActive, + activeAfterInitial, activeDuringFinal, RuleMatchInfo(..), isConLike, isFunLike, InlineSpec(..), noUserInlineSpec, @@ -1142,6 +1143,15 @@ instance Outputable CompilerPhase where ppr (Phase n) = int n ppr InitialPhase = text "InitialPhase" +activeAfterInitial :: Activation +-- Active in the first phase after the initial phase +-- Currently we have just phases [2,1,0] +activeAfterInitial = ActiveAfter NoSourceText 2 + +activeDuringFinal :: Activation +-- Active in the final simplification phase (which is repeated) +activeDuringFinal = ActiveAfter NoSourceText 0 + -- See note [Pragma source text] data Activation = NeverActive | AlwaysActive diff --git a/compiler/basicTypes/MkId.hs b/compiler/basicTypes/MkId.hs index 4cd20ffdc1..47fbce7458 100644 --- a/compiler/basicTypes/MkId.hs +++ b/compiler/basicTypes/MkId.hs @@ -594,7 +594,7 @@ mkDataConRep dflags fam_envs wrap_name mb_bangs data_con | otherwise = topDmd wrap_prag = alwaysInlinePragma `setInlinePragmaActivation` - ActiveAfter NoSourceText 2 + activeAfterInitial -- See Note [Activation for data constructor wrappers] -- The wrapper will usually be inlined (see wrap_unf), so its diff --git a/compiler/specialise/Rules.hs b/compiler/specialise/Rules.hs index 4a4abf768b..ad6a0757cb 100644 --- a/compiler/specialise/Rules.hs +++ b/compiler/specialise/Rules.hs @@ -55,7 +55,7 @@ import NameSet import NameEnv import UniqFM import Unify ( ruleMatchTyKiX ) -import BasicTypes ( Activation, CompilerPhase, isActive, pprRuleName ) +import BasicTypes import DynFlags ( DynFlags ) import Outputable import FastString @@ -290,9 +290,10 @@ addRuleInfo (RuleInfo rs1 fvs1) (RuleInfo rs2 fvs2) = RuleInfo (rs1 ++ rs2) (fvs1 `unionDVarSet` fvs2) addIdSpecialisations :: Id -> [CoreRule] -> Id -addIdSpecialisations id [] - = id addIdSpecialisations id rules + | null rules + = id + | otherwise = setIdSpecialisation id $ extendRuleInfo (idSpecialisation id) rules @@ -312,9 +313,8 @@ ruleIsVisible _ BuiltinRule{} = True ruleIsVisible vis_orphs Rule { ru_orphan = orph, ru_origin = origin } = notOrphan orph || origin `elemModuleSet` vis_orphs -{- -Note [Where rules are found] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +{- Note [Where rules are found] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The rules for an Id come from two places: (a) the ones it is born with, stored inside the Id iself (idCoreRules fn), (b) rules added in other modules, stored in the global RuleBase (imp_rules) diff --git a/compiler/stranal/WorkWrap.hs b/compiler/stranal/WorkWrap.hs index 6289ba039a..34cfd64ecd 100644 --- a/compiler/stranal/WorkWrap.hs +++ b/compiler/stranal/WorkWrap.hs @@ -551,8 +551,8 @@ splitFun dflags fam_envs fn_id fn_info wrap_dmds res_info rhs wrap_rhs = wrap_fn work_id wrap_act = case fn_act of -- See Note [Wrapper activation] ActiveAfter {} -> fn_act - NeverActive -> ActiveAfter NoSourceText 0 - _ -> ActiveAfter NoSourceText 2 + NeverActive -> activeDuringFinal + _ -> activeAfterInitial wrap_prag = InlinePragma { inl_src = SourceText "{-# INLINE" , inl_inline = NoUserInline , inl_sat = Nothing |