[GHC] #8472: Primitive string literals prevent optimization

GHC ghc-devs at haskell.org
Wed Oct 23 12:16:15 UTC 2013


#8472: Primitive string literals prevent optimization
------------------------------+--------------------------------------------
       Reporter:  akio        |             Owner:
           Type:  bug         |            Status:  new
       Priority:  normal      |         Milestone:
      Component:  Compiler    |           Version:  7.6.3
       Keywords:              |  Operating System:  Linux
   Architecture:  x86_64      |   Type of failure:  Runtime performance bug
  (amd64)                     |         Test Case:
     Difficulty:  Unknown     |          Blocking:
     Blocked By:              |
Related Tickets:              |
------------------------------+--------------------------------------------
 Using an Addr# literal seems to result in less aggressive optimization. If
 I compile the attached program like this:

 {{{
 ghc -O2 -fforce-recomp -ddump-simpl addr.hs
 }}}

 the code is optimized nicely. Everything are inlined into {{{t}}},
 intermediate pairs are eliminated, etc.

 However, when I replace the Int# literals in the code with Addr# literals
 by defining the {{{ADDR}}} macro:

 {{{
 ghc -O2 -fforce-recomp -ddump-simpl -DADDR addr.hs
 }}}

 GHC now creates 2 extra top-level bindings, each of which allocates a
 pair. I don't see why the presence of Addr# literals should prevent
 inlining, so I'm reporting a bug.

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


More information about the ghc-tickets mailing list