#2353: GHC inliner doesn't
---------------------------------+------------------------------------------
    Reporter:  guest             |        Owner:              
        Type:  bug               |       Status:  new         
    Priority:  low               |    Milestone:  7.0.1       
   Component:  Compiler          |      Version:  6.9         
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:  Unknown     
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------
Changes (by reinerp):

  * failure:  => None/Unknown


Comment:

 With 7.0.0-rc1, {{{foo}}} is inlined. The core for {{{bar}}} is (a wrapper
 of)
 {{{
 Foo.$wbar =
   \ (@ a_acS)
     (ww_sl0 :: a_acS -> GHC.Types.Int)
     (ww1_sl1 :: GHC.Types.Int -> a_acS)
     (w_sl3 :: GHC.Types.Int -> GHC.Types.Int)
     (w1_sl4 :: a_acS) ->
     let {
       $dC_sld :: Foo.C a_acS
       [LclId]
       $dC_sld = Foo.D:C @ a_acS ww_sl0 ww1_sl1 } in
     Foo.from
       @ a_acS
       $dC_sld
       (w_sl3
          (Foo.to
             @ a_acS
             $dC_sld
             (Foo.from
                @ a_acS $dC_sld (w_sl3 (Foo.to @ a_acS $dC_sld w1_sl4)))))
 }}}

 Also with ghc-7.0.0-rc1, ross's code behaves as desired: {{{f}}} has Core
 {{{

 Foo.$wf =
   \ (@ t_acQ::* -> *)
     (@ a_acR)
     (ww_skO
        :: forall a1_ag3 b_ag4.
           (a1_ag3 -> b_ag4 -> b_ag4) -> b_ag4 -> t_acQ a1_ag3 -> b_ag4)
     (w_skT :: t_acQ a_acR) ->
     case ww_skO
            @ a_acR @ [[a_acR]] (Foo.f1 @ a_acR) (GHC.Types.[] @ [a_acR])
 w_skT
     of _ {
       [] -> GHC.List.last2 @ [a_acR];
       : x_aeY xs_aeZ -> GHC.List.last1 @ [a_acR] x_aeY xs_aeZ
     }
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2353#comment:16>
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