[GHC] #12603: INLINE and manually inlining produce different code

GHC ghc-devs at haskell.org
Thu Oct 20 19:22:56 UTC 2016


#12603: INLINE and manually inlining produce different code
-------------------------------------+-------------------------------------
        Reporter:  bgamari           |                Owner:  bgamari
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by MikolajKonarski):

 I now I remember, I was seeing similar problems in GHC 8 quite a few times
 and I've just stumbled on another, unrelated one. I have a big local
 function used only once. When I INLINE the function, I get 3,421,310,504
 bytes allocated in the heap (runtime 5.32s, but there is much wider
 measurement error margin that with allocation), when I NOINLINE it, I get
 2,932,616,792 (5.17s) and when I leave it alone (I guess GHC inlines it
 somehow differently), I get 4,309,699,560 (5.57s).

 This is with `-O1` and generally nothing special in the .cabal file.
 Alternating between `-A1m` and -A99m` has almost no effect on total
 allocation, though it has on GC, which however scales proportionally to
 the total allocation in each case.

 (BTW, in a prof the left-alone version wins; the numbers are,
 respectively: 5,315,881,616 bytes allocated in the heap, 4,916,409,824,
 4,738,887,896.)

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


More information about the ghc-tickets mailing list