[GHC] #12877: Constant propagation with basic unboxed arithmetic instructions

GHC ghc-devs at haskell.org
Fri Nov 25 12:56:49 UTC 2016


#12877: Constant propagation with basic unboxed arithmetic instructions
-------------------------------------+-------------------------------------
        Reporter:  hsyl20            |                Owner:  hsyl20
            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):

 Interesting.   I'm all for it.

 A good place to look is `SimplUtils.mkCase`.  One thing it does ("Merge
 Nested Cases") is very similar to what you have.  GHC does this:
 {{{
 case x of
   A -> ea
   DEFAULT -> case x of
                 B -> eb
                 C -> ec

 ===>


 case x of
   A -> ea
   B -> eb
   C -> ec
 }}}
 But as you point out, if you just do your second transformation (after "if
 I'm not mistaken...") then the ''existing'' case-merging stuff will do the
 rest.  And I think you might be able do to your second transformation just
 by adding a case to `SimplUtils.mkCase`.

 Yell if you need help.

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


More information about the ghc-tickets mailing list