[Haskell-cafe] force inlining in GHC
Henning Thielemann
lemming at henning-thielemann.de
Tue Apr 29 06:01:39 EDT 2008
Whenever I try to inline a lot of nested function calls, GHC decides to
specialise one of the functions and the specialised function is no longer
inlined. I hoped to get the function inlined anyway by specialising it
manually. Say, I want to inline genericFunc
{-# INLINE genericFunc #-}
genericFunc :: RealFrac a => a -> Int
but GHC inserts a call to genericFunc1 specialised to a=Double where I
apply genericFunc to a Double argument.
Now I define
{-# INLINE doubleFunc #-}
doubleFunc :: Double -> Int
doubleFunc = genericFunc
However, in the Core output 'doubleFunc' does not get the __inline_me tag
and thus will not be inlined, too. :-(
More information about the Haskell-Cafe
mailing list