[GHC] #14827: Recognize when inlining would create a join point
GHC
ghc-devs at haskell.org
Tue Feb 20 11:30:57 UTC 2018
#14827: Recognize when inlining would create a join point
-------------------------------------+-------------------------------------
Reporter: ersetzen | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.2
Resolution: | Keywords: JoinPoints
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
Great example. Can someone explain to me why GHCi is faster? And what it
has to do with INLINE pragmas?
Looking only at the Description, yes loopification should do a good job
here. We'd get this
{{{
letrec
f a = case e of
p1 -> f a'
p2 -> (# l, r #)
in case f e2 of (# l, r #) -> e3
==> (loopify)
let
f a = joinrec jf a = case e of
p1 -> jump jf a'
p2 -> (# l, r #)
in jump jf a
in case f e2 of (# l, r #) -> e3
==> (inline `f`)
case (let a = e2 in
joinrec jf a = case e of
p1 -> jump jf a'
p2 -> (# l, r #)
in jump jf a) of (# l, r #) -> e3
==> (move the outer case inwards, into the RHS of the joinrec)
let a = e2 in
joinrec jf a = case e of
p1 -> jump jf a'
p2 -> case (# l, r #) of (# l, r #) -> e3
in jump jf a
==> (case of known constructor; and inline e2)
joinrec jf a = case e of
p1 -> jump jf a'
p2 -> e3
in jump jf e2
}}}
as desired.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14827#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list