[GHC] #10005: Operations on string literals won't be inlined

GHC ghc-devs at haskell.org
Mon Jan 26 04:58:58 UTC 2015


#10005: Operations on string literals won't be inlined
-------------------------------------+-------------------------------------
        Reporter:  fread2281         |                   Owner:
            Type:  bug               |                  Status:  new
        Priority:  normal            |               Milestone:
       Component:  Compiler          |                 Version:  7.8.4
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  Compile-time      |  Unknown/Multiple
  performance bug                    |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 Your definition of `head'` is wrong of course, but that's not the issue.

 I have good news and bad news.

 * Your program (with the definition of `head'` fixed) does optimize
 properly in HEAD. (I assume due to ticket:9400#comment:9.) It also
 optimizes properly without the `INLINE` pragma.

 * However, if you use the real `Prelude.head`, then rules fire that turn
 `test = head "foo"` into
 {{{
 test =
   GHC.CString.unpackFoldrCString#
     @ Char
     "foo"#
     (\ (x_arw :: Char) _ [Occ=Dead] -> x_arw)
     (GHC.List.badHead @ Char)
 }}}
 and that is more or less a dead end.

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


More information about the ghc-tickets mailing list