[GHC] #12022: unsafeShiftL and unsafeShiftR are not marked as INLINE

GHC ghc-devs at haskell.org
Tue Dec 26 19:46:38 UTC 2017


#12022: unsafeShiftL and unsafeShiftR are not marked as INLINE
-------------------------------------+-------------------------------------
        Reporter:  Rufflewind        |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  libraries/base    |              Version:  7.10.3
      Resolution:                    |             Keywords:  performance,
                                     |  inline, bits
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by m-renaud):

 This all predates me but in comment 2 above thomie@ points out:
 "But that `Note` is older (2008) than the commit that introduced
 `unsafeShiftL/R` ([f1c593e01d740fde1202f84aa37ad4cc95ec7272], 2011)." In
 fact, these functions ''are'' marked INLINE in the typeclass definition
 when they were introduced, and if the assumption is that GHC ''should''
 always inline them, then why not make that explicit in the Int and Word
 instances? It appears this may have simply been an oversight.

 In containers if these functions are not inlined it is my understanding
 that there is a performance hit which is why there is custom code to
 ensure that these shifts are inlined
 (https://github.com/haskell/containers/blob/master/Utils/Containers/Internal/BitUtil.hs#L74-L89).

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


More information about the ghc-tickets mailing list