[GHC] #14619: Output value of program changes upon compiling with -O optimizations

GHC ghc-devs at haskell.org
Sat Dec 30 09:45:35 UTC 2017


#14619: Output value of program changes upon compiling with -O optimizations
-------------------------------------+-------------------------------------
        Reporter:  sheaf             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.2.2
      Resolution:                    |             Keywords:
Operating System:  Windows           |         Architecture:  x86_64
 Type of failure:  Incorrect result  |  (amd64)
  at runtime                         |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------
Changes (by Phyx-):

 * cc: Phyx- (added)


Comment:

 I've attached two cmm files one that work and one that doesn't.

 My initial thought is register pressure, but the working version seems to
 have higher pressure. Looking at the working one, I see only two
 differences,

 1) it uses 8 bytes more of stack space for each function call

 2) it does a lot of redundant moves.

 {{{
 movq 24(%rbx),%rbx
 movq %rbx,%rcx
 movq %rcx,-24(%rbp)
 }}}

 instead of simply

 {{{
 movq 24(%rbx),%rax
 movq %rax,-24(%rbp)
 }}}

 but aside from these two I can't seem to find any real differences.
 There's also slightly different scheduling. Can scheduling be turned off
 in GHC?

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


More information about the ghc-tickets mailing list