[GHC] #14152: Float exit paths out of recursive functions

GHC ghc-devs at haskell.org
Fri Apr 6 08:15:07 UTC 2018


#14152: Float exit paths out of recursive functions
-------------------------------------+-------------------------------------
        Reporter:  nomeata           |                Owner:  (none)
            Type:  task              |               Status:  patch
        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 simonpj):

 {{{
 isExitJoinId :: Var -> Bool
 isExitJoinId id = isJoinId id && isOneOcc (idOccInfo id) && occ_in_lam
 (idOccInfo id)
 }}}
 Isn't the `isOneOcc` redundant?   All join-point should have `OneOcc`.
 Maybe it'd be clearer to say
 {{{
 isExitJoinId id
   | isJoinId id
   = case idOccInfo id of
       IAmDead -> False
       IAmALoopBreaker {} -> False  -- A joinrec is never an exit join-ids
       OneOcc { occ_in_lam = in_lam } -> in_lam
       ManyOccs {} -> pprPanic "isExitJoinId" id
   | otherwise
   = False
 }}}
 Also I'd put this function in `SimplUtils` or something.  Occurrence info
 is only valid on `InIds`, so it's crucial that `isExitJoinId` is only
 called on freshly occ-analysed code.  It's not a generic function you can
 call anywhere.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14152#comment:34>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list