[GHC] #16298: Awful(?) code in AArch64 stg_BLACKHOLE entry code

GHC ghc-devs at haskell.org
Sun Feb 10 01:53:17 UTC 2019


#16298: Awful(?) code in AArch64 stg_BLACKHOLE entry code
-------------------------------------+-------------------------------------
           Reporter:  bgamari        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.7
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:  aarch64        |   Type of failure:  Runtime
                                     |  performance bug
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 It's been a while since I've look at ARM assembler but this doesn't look
 right:

 {{{
 Dump of assembler code for function stg_BLACKHOLE_info$def:
    0x0000ffffb66d6118 <+0>:     mov     x23, x22
    0x0000ffffb66d611c <+4>:     ldr     x22, [x22, #8]
    0x0000ffffb66d6120 <+8>:     tst     x22, #0x7
    0x0000ffffb66d6124 <+12>:    b.ne    0xffffb66d6224
 <stg_BLACKHOLE_info$def+268>  // b.any
    0x0000ffffb66d6128 <+16>:    adrp    x25, 0xffffb66fb000
    0x0000ffffb66d612c <+20>:    adrp    x26, 0xffffb66fb000
    0x0000ffffb66d6130 <+24>:    adrp    x27, 0xffffb66fb000
    0x0000ffffb66d6134 <+28>:    adrp    x29, 0xffffb66fb000
    0x0000ffffb66d6138 <+32>:    ldr     x25, [x25, #3880]
    0x0000ffffb66d613c <+36>:    ldr     x26, [x26, #3888]
    0x0000ffffb66d6140 <+40>:    ldr     x27, [x27, #3896]
    0x0000ffffb66d6144 <+44>:    ldr     x29, [x29, #3904]
    0x0000ffffb66d6148 <+48>:    sub     x24, x19, #0x18
    0x0000ffffb66d614c <+52>:    ldr     x8, [x22]
    0x0000ffffb66d6150 <+56>:    cmp     x8, x25
 ...
 }}}

 Why do we `adrp` four times? Couldn't this be reused, with each `ldr`
 result going to a separate register?

 This was generated by LLVM 7.

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


More information about the ghc-tickets mailing list