id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
2353	GHC inliner doesn't	guest		"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.
"	bug	closed	low	7.0.1	Compiler	6.9	fixed		lennart@…	Unknown/Multiple	Unknown/Multiple	None/Unknown	Unknown				
