Transitive inlining

Manuel M. T. Chakravarty
Tue, 12 Dec 2000 00:41:01 +1100

In the context of the array library, we stumbled over
another problem.  Does GHC transitive inlining across
modules?  Let's say, we have the following scenario:

  module B (foo) where

  {-# INLINE foo #-}
  foo .. =

  {-# INLINE bar #-}
  bar .. = ...

  module L (baz) where

  import B

  {#- INLINE baz #-}
  baz .. =

  module Main where

  import L

  main .. = ...L.baz...

GHC in this case inlines the whole expression ""
in `Main', but will it inline the right hand side of `'
in `Main' (or even of `')?  If the INLINE pragma is
transitive across modules boundaries, one would hope so.

It seems that GHC is not (always?) doing this inlining,
which already for a very simple benchmark costs us a factor
of 5 runtime!  (With inlining - enforced by copying
definitions manually into `Main' - the code produced by GHC
is actually a little bit faster than the code for the
corresponding C program).


PS: I had problems building GHCi and it seems as if my
    message to doesn't get through