[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 06:05:05 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 GordonBGood):

 Replying to [comment:12 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 on #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.

 Thanks for your reply and explanation; I've seen the same types of things
 with 7.6.3 comparing tight loops, but more generally just much less
 efficient use of registers by NCG as compared to LLVM with many more
 register spills and reloads; however, the 32-bit version of 7.8.1 RC2's
 new NCG is even worse as per my bug report.

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


More information about the ghc-tickets mailing list