GHC thinks it is smarter than me [was: RE: Transitive inlining]

Manuel M. T. Chakravarty chak@cse.unsw.edu.au
Mon, 25 Dec 2000 22:11:02 +1100


Simon Peyton-Jones <simonpj@microsoft.com> wrote,

> Yes, all the inlining you expect should indeed happen. If
> it doesn't can you show us an example?

Meanwhile, I think, the lack of inlining that I saw isn't
connected to modules.  Instead, the problem is that GHC
thinks it knows more about my program than I do.  More
precisely, it seems to take an INLINE pragma just as an
encouragement rather than a command to inline.  In
particular - at least if a function is large enough - it
doesn't inline the function anymore if the function is used
more than once.[1]

This behaviour is a problem for our array library.  We need
very aggressive inlining.  Would it maybe be possible to
make -O2 interpret INLINE pragmas as obligatory?

Cheers,
Manuel

[1] The function in question actually uses an INLINE 2
    pragma - I guess that this doesn't matter.