diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2019-11-01 17:26:12 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2019-11-01 17:26:47 +0000 |
commit | 8c40e3f98649d6d3310a1181add7d2af6f6b7c87 (patch) | |
tree | 6e43ac2cf1df40df629560fb39e83ab5ee632bda /compiler/coreSyn/CoreUnfold.hs | |
parent | b0102bcf850edb63b8d88c11361f54bda3fe2417 (diff) | |
download | haskell-wip/inline-compulsory.tar.gz |
More wibbleswip/inline-compulsory
Diffstat (limited to 'compiler/coreSyn/CoreUnfold.hs')
-rw-r--r-- | compiler/coreSyn/CoreUnfold.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs index 8853b8592b..bf082518c9 100644 --- a/compiler/coreSyn/CoreUnfold.hs +++ b/compiler/coreSyn/CoreUnfold.hs @@ -1120,11 +1120,12 @@ certainlyWillInline :: DynFlags -> IdInfo -> Maybe Unfolding -- ^ Sees if the unfolding is pretty certain to inline. -- If so, return a *stable* unfolding for it, that will always inline. certainlyWillInline dflags fn_info - = case unfoldingInfo fn_info of - CoreUnfolding { uf_tmpl = e, uf_guidance = g } - | loop_breaker -> Nothing -- Won't inline, so try w/w - | noinline -> Nothing -- See Note [Worker-wrapper for NOINLINE functions] - | otherwise -> do_cunf e g -- Depends on size, so look at that + = case fn_unf of + CoreUnfolding { uf_tmpl = e, uf_guidance = g, uf_src = src } + | loop_breaker -> Nothing -- Won't inline, so try w/w + | noinline -> Nothing -- See Note [Worker-wrapper for NOINLINE functions] + | compulsory src -> Just fn_unf + | otherwise -> do_cunf e g -- Depends on size, so look at that DFunUnfolding {} -> Just fn_unf -- Don't w/w DFuns; it never makes sense -- to do so, and even if it is currently a @@ -1137,6 +1138,9 @@ certainlyWillInline dflags fn_info noinline = inlinePragmaSpec (inlinePragInfo fn_info) == InlSpecNoInline fn_unf = unfoldingInfo fn_info + compulsory InlineCompulsory = True + compulsory _ = False + do_cunf :: CoreExpr -> UnfoldingGuidance -> Maybe Unfolding do_cunf _ UnfNever = Nothing do_cunf _ (UnfWhen {}) = Just (fn_unf { uf_src = InlineStable }) |