[GHC] #8971: Native Code Generator 7.8.1 RC2 is not as optimized as 7.6.3...

GHC ghc-devs at haskell.org
Fri Apr 25 05:40:37 UTC 2014


#8971: Native Code Generator 7.8.1 RC2 is not as optimized as 7.6.3...
--------------------------------------------+------------------------------
        Reporter:  GordonBGood              |            Owner:
            Type:  bug                      |           Status:  new
        Priority:  normal                   |        Milestone:
       Component:  Compiler (NCG)           |          Version:  7.8.1-rc2
      Resolution:                           |         Keywords:
Operating System:  Unknown/Multiple         |     Architecture:
 Type of failure:  Runtime performance bug  |  Unknown/Multiple
       Test Case:                           |       Difficulty:  Unknown
        Blocking:                           |       Blocked By:
                                            |  Related Tickets:
--------------------------------------------+------------------------------

Comment (by awson):

 Replying to [comment:8 GordonBGood]:
 > This bug has nothing to do with the difference between the LLVM and the
 NCG compiler backends; it it well known that NCG isn't that efficient for
 tight loops.  For this bug use case code, NCG has never combined the
 memory read, the 'and' operation, and the memory write into one
 read/modify/write instruction whereas LLVM does, which explains the
 difference between them.

 Oh, I know this. But in the last days I fought with a pile of bugs in
 64-bit Windows GHC and I saw a lot of NCG-produced assembly that was bad
 far beyond what you've described above.

 Off the top of my head, when I worked with #8974, I saw this:
 {{{
         call suspendThread
         addq $40,%rsp
         subq $8,%rsp
         subq $32,%rsp
         movq %rax,%rbx
         movl $0,%eax
         call performMajorGC
         addq $40,%rsp
         movq %rbx,%rcx
         subq $8,%rsp
         subq $32,%rsp
         movl $0,%eax
         call resumeThread
 }}}
 produced by NCG, versus
 {{{
         callq   suspendThread
         movq    %rax, %rsi
         callq   performMajorGC
         movq    %rsi, %rcx
         callq   resumeThread
 }}}
 produced by LLVM.

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


More information about the ghc-tickets mailing list