#13890: Loss of inlining after strictness analysis -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- While investigating something else I saw this in the final `Tidy Core` after optimisation {{{ join { wild_X5jU [Dmd=<S,1*U>] :: (# State# RealWorld, Array Int HValue #) [LclId[JoinId(0)], Unf=Unf{Src=InlineStable, TopLvl=False, Value=False, ConLike=False, WorkFree=False, Expandable=False, Guidance=ALWAYS_IF(arity=0,unsat_ok=True,boring_ok=False) Tmpl= jump $j1_s5RP w_s5Qs}] wild_X5jU = jump $j1_s5RP ww_s5Qw } in jump wild_X5jU; }}} That's ridiculous! Why wasn't it inlined at its (only!) use site? It turns out that * The original `InlineStable` came from when `wild` was lambda-bound. See `Note [Case binders and join points]` in `Simplify.hs` * But then worker-wrapper let-binds that previously-lambda-boudn arg in `WwLib.mkWWstr_one`. But it does not remove the unfolding. That's bad; in contrast, when we beta-reduce we are careful to remove the unfolding; see `Note [Zap unfolding when beta-reducing]` in `Simplify.hs`. * We don't `preInlineUnconditionally` things with stable unfoldings; see `Note [Stable unfoldings and preInlineUnconditionally]` in `SimplUtils` Net result: it doesn't get inlined at all! Easy fix: zap the unfolding in `mkWWstr_one` as well. I'm unhappy with the whole business of passing both boxed and unboxed versions, described in `Note [Case binders and join points]`. It smells wrong, and this ticket is another canary. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13890> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler