[GHC] #15560: Full laziness destroys opportunities for join points
GHC
ghc-devs at haskell.org
Thu Aug 23 21:45:05 UTC 2018
#15560: Full laziness destroys opportunities for join points
-------------------------------------+-------------------------------------
Reporter: AndreasK | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone: 8.6.1
Component: Compiler | Version: 8.4.3
(CodeGen) |
Keywords: JoinPoints | Operating System: Unknown/Multiple
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets: #14287
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Even if we already know a binding is a join point we STILL float it to the
top and turn it into a function.
The simple example below results in a join point after the first
simplifier run. Then we run the float out pass immediately undoing this by
making it a top level binding.
It then stays at the top till we are done resulting in the core I've put
in the comments.
{{{
#!haskell
data T = A | B | C | D | E | F | G
{-# NOINLINE n #-}
n :: T -> T
n A = B
n B = C
n _ = A
f :: Int -> T -> T -> T
f sel x y =
-- function large enough to avoid being simply inlined
let j z = n . n . n . n . n . n $ z
in case sel of
-- j is always tailcalled
0 -> j x
_ -> j y
-- j is floated to top level instead of ending up as joinpoint.
-- T.f_j
-- = \ (eta_B1 [OS=OneShot] :: T) -> n (n (n (n (n (n eta_B1)))))
-- -- RHS size: {terms: 14, types: 6, coercions: 0, joins: 0/0}
-- f :: Int -> T -> T -> T
-- f = \ (sel_aYP :: Int) (x_aYQ :: T) (y_aYR :: T) ->
-- case sel_aYP of { GHC.Types.I# ds_d2fL ->
-- case ds_d2fL of {
-- __DEFAULT -> T.f_j y_aYR;
-- 0# -> T.f_j x_aYQ
-- }
-- }
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15560>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list