[GHC] #9136: Constant folding in Core could be better

GHC ghc-devs at haskell.org
Fri May 23 07:54:37 UTC 2014


#9136: Constant folding in Core could be better
------------------------------+--------------------------------------------
       Reporter:  simonpj     |             Owner:
           Type:  bug         |            Status:  new
       Priority:  normal      |         Milestone:
      Component:  Compiler    |           Version:  7.8.2
       Keywords:              |  Operating System:  Unknown/Multiple
   Architecture:              |   Type of failure:  Runtime performance bug
  Unknown/Multiple            |         Test Case:
     Difficulty:  Unknown     |          Blocking:
     Blocked By:              |
Related Tickets:              |
------------------------------+--------------------------------------------
 Constant folding in Core is still a bit feeble.  For example, when staring
 at the code for `nofib/shootout/k-nucleotide` I saw this expression:
 {{{
  (x +# 8) -# 1
 }}}
 which would be relatively easy to optimise.

 The difficulty is knowing where to stop.  What about `(8 +# x) -# 1`?

 Anyway, this ticket is to record the issue.  Currently constant folding is
 done by the built-in RULES in `compiler/prelude/PrelRules`.

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


More information about the ghc-tickets mailing list