[GHC] #14079: Failure to do CPR in the presence of a local letrec
GHC
ghc-devs at haskell.org
Wed Aug 2 18:59:58 UTC 2017
#14079: Failure to do CPR in the presence of a local letrec
-------------------------------------+-------------------------------------
Reporter: nomeata | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.3
Resolution: | Keywords: JoinPoints
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 nomeata):
Ah, in this case, this is because `certainlyWillInline` returns `True` for
`e`, so `tryWW` will refrain from W/W’ing this function. If I mark it as
`NOINLINE` then we get the desired code (note that the join-point has it’s
return type changes as well:)
{{{
$we [InlPrag=NOINLINE] :: Int -> Int -> Int# -> Int -> (# Int, Int #)
[LclId, Arity=4, Str=<L,U><L,U><S,U><L,U(U)>,
Unf=Unf{Src=<vanilla>, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=4,unsat_ok=True,boring_ok=True)}]
$we
= \ (ww :: Int)
(ww :: Int)
(ww [Dmd=<S,U>] :: Int#)
(w [Dmd=<L,U(U)>] :: Int) ->
joinrec {
$wje [InlPrag=[0], Occ=LoopBreaker] :: Int -> Int -> Int# -> (#
Int, Int #)
[LclId[JoinId(3)], Arity=3, Str=<L,U><L,U><S,U>,
Unf=Unf{Src=<vanilla>, TopLvl=False, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=3,unsat_ok=True,boring_ok=True)}]
$wje (ww :: Int) (ww :: Int) (ww [Dmd=<S,U>] :: Int#)
= case ># ww 0# of {
__DEFAULT -> case w of { I# y [Dmd=<S,U>] -> jump $wje ww ww
(+# ww y) };
1# -> (# ww, ww #)
}; } in
jump $wje ww ww ww
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14079#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list