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

GHC ghc-devs at haskell.org
Fri Apr 6 21:44:11 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 nomeata):

 > All join-point should have `OneOcc`

 Not true, it seems, as witnessed by
 `testsuite/tests/codeGen/should_compile/jmp_tbl.hs` (already with `-O`, so
 without exitification):

 {{{
 ./inplace/bin/ghc-stage2 -dcore-lint testsuite/**/jmp_tbl.hs -O -dverbose-
 core2core -ddump-simpl-iterations -fforce-recomp
 …
       join {
         $j_s3v8
           :: (# GHC.Prim.State# GHC.Prim.RealWorld, (PipeState, b_a2YY) #)
         [LclId[JoinId(0)]]
         $j_s3v8 = case lvl_s3te of wild_00 { } } in
       join {
         $j_s3ve
           :: (# GHC.Prim.State# GHC.Prim.RealWorld, (PipeState, b_a2YY) #)
         [LclId[JoinId(0)]]
         $j_s3ve
           = join {
               $j_s3vc
                 :: (# GHC.Prim.State# GHC.Prim.RealWorld, (PipeState,
 b_a2YY) #)
               [LclId[JoinId(0)]]
               $j_s3vc
                 = join {
                     $j_s3va
                       :: (# GHC.Prim.State# GHC.Prim.RealWorld,
 (PipeState, b_a2YY) #)
                     [LclId[JoinId(0)]]
                     $j_s3va = case phase_X1s7 of { __DEFAULT -> jump
 $j_s3v7 } } in
                   case phase_X1s7 of {
                     __DEFAULT -> jump $j_s3va;
                     HCc -> jump $j_s3v8
                   } } in
             case phase_X1s7 of {
               __DEFAULT -> jump $j_s3vc;
               Ccpp -> jump $j_s3v8
             } } in
       case phase_X1s7 of {
         __DEFAULT -> jump $j_s3ve;
         Cc -> jump $j_s3v8
 }}}

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


More information about the ghc-tickets mailing list