#6087: Join points need strictness analysis
---------------------------------+------------------------------------------
    Reporter:  simonpj           |       Owner:                         
        Type:  bug               |      Status:  new                    
    Priority:  normal            |   Milestone:  7.6.1                  
   Component:  Compiler          |     Version:  7.4.1                  
    Keywords:                    |          Os:  Unknown/Multiple       
Architecture:  Unknown/Multiple  |     Failure:  Runtime performance bug
  Difficulty:  Unknown           |    Testcase:                         
   Blockedby:                    |    Blocking:                         
     Related:                    |  
---------------------------------+------------------------------------------
 I came across this code in the `nofib/spectral` progam `knights`, in the
 code for `KnightHeuristic.possibleMoves`:
 {{{
 let {
   $j_sU3
     :: GHC.Types.Int -> GHC.Types.Int -> [KnightHeuristic.Direction]
   [LclId, Arity=2]
   $j_sU3 =
     \ (ww2_sRl :: GHC.Types.Int) (ww3_sRm :: GHC.Types.Int) ->
       case ww2_sRl of ww4_XQY { GHC.Types.I# ww5_sQU ->
       case GHC.Prim.>=# ww5_sQU 1 of _ {
         GHC.Types.False -> go1_azF ys_azM;
         GHC.Types.True ->
           case ds1_azR of _ { GHC.Types.I# y1_azp ->
           case GHC.Prim.<=# ww5_sQU y1_azp of _ {
             GHC.Types.False -> go1_azF ys_azM;
             GHC.Types.True ->
               case ww3_sRm of wild6_XAB { GHC.Types.I# x_XAE ->
               case GHC.Prim.>=# x_XAE 1 of _ {
                 GHC.Types.False -> go1_azF ys_azM;
                 GHC.Types.True ->
                   case GHC.Prim.<=# x_XAE y1_azp of _ {
                     GHC.Types.False -> go1_azF ys_azM;
                     GHC.Types.True ->
                       case GHC.List.notElem
                              @ ChessSetList.Tile
                              ChessSetList.isSquareFree_$dEq
                              (ww4_XQY, wild6_XAB)
                              wild2_azW
                       of _ {
                         GHC.Types.False -> go1_azF ys_azM;
                         GHC.Types.True ->
                           GHC.Types.:
                             @ KnightHeuristic.Direction y_azL (go1_azF
 ys_azM)
                       }
                   }
               }
               }
           }
           }
       }
       } } in
 case y_azL of _ {
   KnightHeuristic.UL ->
     $j_sU3
       (case ww_sQJ of _ { GHC.Types.I# x_aya ->
        GHC.Types.I# (GHC.Prim.-# x_aya 1)
        })
       (case ww1_sQK of _ { GHC.Types.I# x_aya ->
        GHC.Types.I# (GHC.Prim.-# x_aya 2)
        });
   KnightHeuristic.UR ->
     $j_sU3
       (case ww_sQJ of _ { GHC.Types.I# x_ayl ->
        GHC.Types.I# (GHC.Prim.+# x_ayl 1)
        })
       (case ww1_sQK of _ { GHC.Types.I# x_aya ->
        GHC.Types.I# (GHC.Prim.-# x_aya 2)
        });

 ...lots more similar case alternatives follow...
 }}}
 Just look at all those `Int`s getting boxed, and the immediately unboxed
 by the join point!  The strictness analyser would spot this easily, but
 presumably the join point is constructed after strictness analysis.

 There must be an opportunity here to run a later strictness analysis pass.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6087>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to