[GHC] #13397: Optimise calls to tagToEnum#

GHC ghc-devs at haskell.org
Wed Mar 8 10:48:59 UTC 2017


#13397: Optimise calls to tagToEnum#
-------------------------------------+-------------------------------------
           Reporter:  simonpj        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Ever since we started using `Int#` to represent booleans unboxed (see
 [wiki:PrimBool]) we have had lots of code looking like
 {{{
 case tagToEnum# (a ># b) of
   False -> e1
   True  -> e2
 }}}
 It would be better (less code to optimise, more straightforward, more
 direct) to optimise this to
 {{{
 case a ># b of
   DEFAULT -> e1
   1#      -> e2
 }}}
 Happily, we already have a nice spot to do so: the `caseRules` function in
 `SimplUtils`.

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


More information about the ghc-tickets mailing list