#4428: Local functions lose their unfoldings
---------------------------------+------------------------------------------
    Reporter:  rl                |       Owner:                         
        Type:  bug               |      Status:  new                    
    Priority:  normal            |   Component:  Compiler               
     Version:  7.1               |    Keywords:                         
    Testcase:                    |   Blockedby:                         
          Os:  Unknown/Multiple  |    Blocking:                         
Architecture:  Unknown/Multiple  |     Failure:  Runtime performance bug
---------------------------------+------------------------------------------
 I'm attaching 2 modules, both should be compiled with -O2. Let's look at
 the inteface of `Foo`:

 {{{
   foo :: (GHC.Types.Int, GHC.Types.Int)
          -> [GHC.Types.Int]
          -> [GHC.Types.Int]
     {- Arity: 2, Strictness: U(U(L)U(L))L, Inline: INLINE (sat-args=2),
        Unfolding: InlineRule (2, False, False)
                   (\ ds :: (GHC.Types.Int, GHC.Types.Int) xs ::
 [GHC.Types.Int] ->
                    case @ [GHC.Types.Int] ds of wild { (i, n) ->
                    let {
                      step :: forall t.
                              ([t], GHC.Types.Int, GHC.Types.Int)
                              -> Data.Maybe.Maybe (([t], GHC.Types.Int,
 GHC.Types.Int), t)
                        {- Inline: INLINE[0] (sat-args=1) -}
                      = ...

 }}}

 Note how `step`, which is local to `foo`, has an `INLINE` pragma but no
 unfolding. Now, let's look at `Bar`. For some reason, GHC only inlines
 `foo` into `bar` in phase 1. This is probably unrelated but still
 surprising. The main problem, though, is that `step`, not having an
 unfolding, doesn't get inlined at all despite the `INLINE` pragma.

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