[GHC] #10766: user manual: INLINE's interaction with optimization levels is not clear

GHC ghc-devs at haskell.org
Tue Aug 11 18:40:40 UTC 2015


#10766: user manual: INLINE's interaction with optimization levels is not clear
-------------------------------------+-------------------------------------
              Reporter:  osa1        |             Owner:
                  Type:  task        |            Status:  new
              Priority:  normal      |         Milestone:
             Component:              |           Version:  7.11
  Documentation                      |
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  Other
  Unknown/Multiple                   |
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 user manual: INLINE's interaction with optimization levels is not clear

 From the user manual it's not possible to say how should INLINE and actual
 inlining behavior should interact with optimization levels.

 What the user manuals says:

 - Without INLINE GHC tries to inline depending on size of definitions and
 current optimization level(user manual says -O is needed, but can we
 assume that for any inlining to be done we need at least -O? Because I
 have an example in which inlining is happening even with -O0).

 - With INLINE GHC tries hard to inline. But it doesn't say which
 optimization level is needed.

 I think we should add word or two about this. Does anyone know the answer
 here?

 My guess is: Even though INLINE makes sure GHC saves RHS of the definition
 in .hi files to be able to inline later, optimization levels still have an
 effect on deciding whether to inline or not. Because some INLINEd RHSs may
 be too big in which case it may decide not to inline with -O1 but inline
 with -O2 etc.

 Furthermore, without -O, GHC doesn't mark definitions as INLINE. But if we
 have INLINEd definitions and compiling a code with -O0, it may still
 inline those definitions, because there are two different mechanisms to
 decide whether to mark as INLINE and whether to inline the RHS, and while
 without -O GHC doesn't mark anything as INLINE, it can still inline
 previously marked definitions.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10766>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list