[GHC] #13397: Optimise calls to tagToEnum#

GHC ghc-devs at haskell.org
Fri Apr 28 22:07:44 UTC 2017


#13397: Optimise calls to tagToEnum#
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by David Feuer <David.Feuer@…>):

 In [changeset:"6d14c1485cb570cbd183bcdc0f858d9a6dc1eb31/ghc"
 6d14c148/ghc]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="6d14c1485cb570cbd183bcdc0f858d9a6dc1eb31"
 Improve code generation for conditionals

 This patch in in preparation for the fix to Trac #13397

 The code generator has a special case for
   case tagToEnum (a>#b) of
     False -> e1
     True  -> e2

 but it was not doing nearly so well on
   case a>#b of
     DEFAULT -> e1
     1#      -> e2

 This patch arranges to behave essentially identically in
 both cases.  In due course we can eliminate the special
 case for tagToEnum#, once we've completed Trac #13397.

 The changes are:

 * Make CmmSink swizzle the order of a conditional where necessary;
   see Note [Improving conditionals] in CmmSink

 * Hack the general case of StgCmmExpr.cgCase so that it use
   NoGcInAlts for conditionals.  This doesn't seem right, but it's
   the same choice as the tagToEnum version. Without it, code size
   increases a lot (more heap checks).

   There's a loose end here.

 * Add comments in CmmOpt.cmmMachOpFoldM
 }}}

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


More information about the ghc-tickets mailing list