summaryrefslogtreecommitdiff
path: root/compiler/coreSyn/CoreUnfold.hs
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2019-02-19 13:52:11 +0100
committerSebastian Graf <sebastian.graf@kit.edu>2019-02-19 14:36:57 +0100
commit70ebc57eddc0951128184482aabe30fb84aada70 (patch)
treee787c9640147a68c024c1c345f4013a3d8245c8a /compiler/coreSyn/CoreUnfold.hs
parent9f5b11fa6a0bc32888fa88b6c3d57baa2e734c64 (diff)
downloadhaskell-wip/ww-noinline.tar.gz
Always do the worker/wrapper split for NOINLINEswip/ww-noinline
Trac #10069 revealed that small NOINLINE functions didn't get split into worker and wrapper. This was due to `certainlyWillInline` saying that any unfoldings with a guidance of `UnfWhen` inline unconditionally. That isn't the case for NOINLINE functions, so we catch this case earlier now. Fixes #10069.
Diffstat (limited to 'compiler/coreSyn/CoreUnfold.hs')
-rw-r--r--compiler/coreSyn/CoreUnfold.hs13
1 files changed, 6 insertions, 7 deletions
diff --git a/compiler/coreSyn/CoreUnfold.hs b/compiler/coreSyn/CoreUnfold.hs
index 3ac35c9848..9bb6231338 100644
--- a/compiler/coreSyn/CoreUnfold.hs
+++ b/compiler/coreSyn/CoreUnfold.hs
@@ -1118,13 +1118,14 @@ smallEnoughToInline _ _
----------------
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
+-- ^ 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
- | otherwise -> do_cunf e g -- Depends on size, so look at that
+ | loop_breaker -- Loop breakers and NOINLINEs
+ || noinline -> Nothing -- won't inline, so try w/w
+ | 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
@@ -1134,6 +1135,7 @@ certainlyWillInline dflags fn_info
where
loop_breaker = isStrongLoopBreaker (occInfo fn_info)
+ noinline = inlinePragmaSpec (inlinePragInfo fn_info) == NoInline
fn_unf = unfoldingInfo fn_info
do_cunf :: CoreExpr -> UnfoldingGuidance -> Maybe Unfolding
@@ -1148,9 +1150,6 @@ certainlyWillInline dflags fn_info
-- See Note [certainlyWillInline: INLINABLE]
do_cunf expr (UnfIfGoodArgs { ug_size = size, ug_args = args })
| not (null args) -- See Note [certainlyWillInline: be careful of thunks]
- , case inlinePragmaSpec (inlinePragInfo fn_info) of
- NoInline -> False -- NOINLINE; do not say certainlyWillInline!
- _ -> True -- INLINE, INLINABLE, or nothing
, not (isBottomingSig (strictnessInfo fn_info))
-- Do not unconditionally inline a bottoming functions even if
-- it seems smallish. We've carefully lifted it out to top level,