[GHC] #12984: Missed constant folding oportunities (associativity)

GHC ghc-devs at haskell.org
Thu Dec 15 12:07:07 UTC 2016


#12984: Missed constant folding oportunities (associativity)
-------------------------------------+-------------------------------------
        Reporter:  hsyl20            |                Owner:
            Type:  feature request   |               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 simonpj):

 Ideally, express it as a bunch of rewrite rules (`prelude/PrelRules.hs`).
 I don't know if that is conveniently possible for assoc/distrib laws.

 Don't forget to take care about overflow etc.  You will know this better
 than I but computer arithmetic doesn't obey all the same laws as
 mathematics!

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


More information about the ghc-tickets mailing list