[GHC] #13890: Loss of inlining after strictness analysis
#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
#13890: Loss of inlining after strictness analysis -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"87c5fdbba118db1938d699951a811cc2f6206d4d/ghc" 87c5fdb/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="87c5fdbba118db1938d699951a811cc2f6206d4d" Zap stable unfoldings in worker/wrapper This patch fixes the buglet described in Trac #13890. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13890#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13890: Loss of inlining after strictness analysis -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13890#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#13890: Loss of inlining after strictness analysis -------------------------------------+------------------------------------- Reporter: simonpj | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 Resolution: fixed | Keywords: Inlining Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by mpickering): * keywords: => Inlining -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13890#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC