[GHC] #14068: Turn tail-recursive functions into recursive jointpoints
GHC
ghc-devs at haskell.org
Mon Jul 31 17:21:15 UTC 2017
#14068: Turn tail-recursive functions into recursive jointpoints
-------------------------------------+-------------------------------------
Reporter: nomeata | 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:
-------------------------------------+-------------------------------------
The function
{{{
let f x y = case y of
A -> f x' y'
B -> e2
C -> e3
in g f
}}}
is not turned into a recursive join point, because the call to `f` is not
in tail call position. But the recursive calls are, and these matter
performance-wise! Hence, it would be beneficial to turn this into
{{{
let f x y = joinrec $j x y = case x y of
A -> $j x' y'
B -> e2
C -> e3
in $j x y
in g f
}}}
This has the additional effect that now `f` is no longer recursive and may
get inlined.
This came up in #13966, and might go well with #14067.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14068>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list