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

GHC ghc-devs at haskell.org
Sat May 24 21:19:10 UTC 2014


#9136: Constant folding in Core could be better
--------------------------------------------+------------------------------
        Reporter:  simonpj                  |            Owner:  nomeata
            Type:  bug                      |           Status:  patch
        Priority:  normal                   |        Milestone:
       Component:  Compiler                 |          Version:  7.8.2
      Resolution:                           |         Keywords:
Operating System:  Unknown/Multiple         |     Architecture:
 Type of failure:  Runtime performance bug  |  Unknown/Multiple
       Test Case:                           |       Difficulty:  Unknown
        Blocking:                           |       Blocked By:
                                            |  Related Tickets:
--------------------------------------------+------------------------------

Comment (by carter):

 @nomeata .... so I thought a bit about your reply... and part of my
 concern stems from the fact that the wrapping behavior of Int in GHC is
 actually a choice of "undefined" behavior by the various Haskell language
 standards.  Point being, while wrap around is "folklore behavior", its
 actually deemed undefined by the standard. And it constitutes moving that
 undefined "folklore" into being a strong assumption in ghc.

 how would GCC come into play? theres no peephole optimization by the
 system assembler level in -fasm to my knowledge.

 most of the examples i've seen where arithmetic optimization makes a HUGE
 win are in the context of heavy bit fiddling sequences (I have some
 example that are 40 instructions long in -fasm, but optimized to  NOOP on
 -fllvm), and various sophisticated array indexing computations.

 If nofib doesn't show a measurable difference and theres no motivating
 example program that shows a strong win.. I'd argue its not worth adding
 the rules.

 I'm happy to share some more interesting examples, but I'm not sure if
 they actually can be handled by a rewrite rules discipline.

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


More information about the ghc-tickets mailing list