[GHC] #14152: Float exit paths out of recursive functions
GHC
ghc-devs at haskell.org
Tue Aug 29 17:40:45 UTC 2017
#14152: Float exit paths out of recursive functions
-------------------------------------+-------------------------------------
Reporter: nomeata | Owner: (none)
Type: task | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
Resolution: | Keywords: JoinPoints
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #14137 #10918 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by nomeata):
Thanks for the guidance, that nailed it:
* The code `isJoinId bndr, isOneOcc (idOccInfo bndr), occ_in_lam
(idOccInfo bndr)` reliably detects an exit join point now, it seems. (I
guess this deserves its own function `isExitJoinPoint`)
* When I create the join point, I add the correct `OccInfo`, so that this
is there even before OccurAnal runs the next time.
* In `simplLetUnfolding`, when I detect an exit join point, I do not
creating an unfolding. This prevents unfolding in `completeCall` and
`postInlineUnconditionally`.
* In `preInlineUnconditionally` I check for exit join points explicityly.
Maybe it would be cleaner to leave the unfolding alone and simply check
for `isExitJoinPoint` in all three places… but no, the simplifier seems to
throw away the `idOccInfo`. So better stick to not creating an unfolding.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14152#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list