#2353: GHC inliner doesn't
------------------------+---------------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 6.9 | Severity: normal
Keywords: | Testcase:
Architecture: Unknown | Os: Unknown
------------------------+---------------------------------------------------
Compile this program
{{{
{-# OPTIONS_GHC -O2 -ddump-simpl #-}
module Foo where
class C a where
to' :: a -> Int
from' :: Int -> a
{-# NOINLINE to #-}
to :: (C a) => a -> Int
to = to'
{-# NOINLINE from #-}
from :: (C a) => Int -> a
from = from'
{-# INLINE foo #-}
foo :: (C a) => (Int -> Int) -> a -> a
foo f x = from (f (to x))
bar :: (C a) => (Int -> Int) -> a -> a
bar f = foo f . foo f
}}}
Study the output. It contains
{{{
...
Foo.foo =
__inline_me (\ (@ a_a6n) ($dC_a6t :: Foo.C a_a6n) ->
...
}}}
and
{{{
...
Foo.bar =
\ (@ a_a6w) ($dC_a6G :: Foo.C a_a6w) ->
let {
foo1_s7S [ALWAYS Just L] :: (GHC.Base.Int -> GHC.Base.Int) -> a_a6w
-> a_a6w
[Str: DmdType]
foo1_s7S = Foo.foo @ a_a6w $dC_a6G
...
}}}
Why isn't foo inlined?
Note that if the export list is changed to only export bar, then foo does
get inlined.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2353>
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