[Haskell-cafe] force inlining in GHC

Simon Peyton-Jones simonpj at microsoft.com
Tue Apr 29 06:06:31 EDT 2008

As luck would have it, I'm working on INLINE pragmas for Roman right at this moment.

Could you spare a moment to give me a concrete test case, to make sure I hit your case too? If you can give me a program that doesn't optimise as you expect, I'm much more likely to get it right.



| -----Original Message-----
| From: haskell-cafe-bounces at haskell.org [mailto:haskell-cafe-bounces at haskell.org] On Behalf Of Henning
| Thielemann
| Sent: 29 April 2008 11:02
| To: Haskell Cafe
| Subject: [Haskell-cafe] force inlining in GHC
| 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. :-(
| _______________________________________________
| Haskell-Cafe mailing list
| Haskell-Cafe at haskell.org
| http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list