summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2020-12-08 12:40:46 +0100
committerSebastian Graf <sebastian.graf@kit.edu>2020-12-08 12:40:46 +0100
commit584ce1047f9aeb5f1a2e40ce0dc0249fd8180734 (patch)
treef4660f13bd555ac175a2920f6385bc9e06afa992
parent95dd3cdeb91ed90adcd9a497ddb8432a422c30a2 (diff)
downloadhaskell-584ce1047f9aeb5f1a2e40ce0dc0249fd8180734.tar.gz
A few changes to callSiteInline, acting as a bookmark
-rw-r--r--compiler/GHC/Core/Unfold.hs14
1 files changed, 10 insertions, 4 deletions
diff --git a/compiler/GHC/Core/Unfold.hs b/compiler/GHC/Core/Unfold.hs
index a410bac6e1..ac063b4af4 100644
--- a/compiler/GHC/Core/Unfold.hs
+++ b/compiler/GHC/Core/Unfold.hs
@@ -51,7 +51,7 @@ import GHC.Core.DataCon
import GHC.Types.Literal
import GHC.Builtin.PrimOps
import GHC.Types.Id.Info
-import GHC.Types.Basic ( Arity, InlineSpec(..), inlinePragmaSpec )
+import GHC.Types.Basic ( Arity, InlineSpec(..), inlinePragmaSpec, staticArgsInfo, noStaticArgs )
import GHC.Core.Type
import GHC.Builtin.Names
import GHC.Builtin.Types.Prim ( realWorldStatePrimTy )
@@ -1076,14 +1076,17 @@ instance Outputable CallCtxt where
ppr RuleArgCtxt = text "RuleArgCtxt"
callSiteInline dflags id active_unfolding lone_variable arg_infos cont_info
- = case idUnfolding id of
- -- idUnfolding checks for loop-breakers, returning NoUnfolding
+ = case unfoldingInfo (idInfo id) of
+ -- Don't call idUnfolding, because we want unfolding for loop-breakers
+ -- if they have static arguments
-- Things with an INLINE pragma may have an unfolding *and*
-- be a loop breaker (maybe the knot is not yet untied)
CoreUnfolding { uf_tmpl = unf_template
, uf_is_work_free = is_wf
, uf_guidance = guidance, uf_expandable = is_exp }
- | active_unfolding -> tryUnfolding dflags id lone_variable
+ | active_unfolding
+ , isStrongLoopBreaker (idOccInfo id) ==> has_static_args id
+ -> tryUnfolding dflags id lone_variable
arg_infos cont_info unf_template
is_wf is_exp guidance
| otherwise -> traceInline dflags id "Inactive unfolding:" (ppr id) Nothing
@@ -1091,6 +1094,9 @@ callSiteInline dflags id active_unfolding lone_variable arg_infos cont_info
BootUnfolding -> Nothing
OtherCon {} -> Nothing
DFunUnfolding {} -> Nothing -- Never unfold a DFun
+ where
+ b ==> t = not b || t
+ has_static_args id = staticArgsInfo (idOccInfo id) /= noStaticArgs
-- | Report the inlining of an identifier's RHS to the user, if requested.
traceInline :: DynFlags -> Id -> String -> SDoc -> a -> a