[GHC] #9617: Try to replace `quot` and `rem` with `quotRem` when possible

GHC ghc-devs at haskell.org
Fri Sep 19 20:45:36 UTC 2014


#9617: Try to replace `quot` and `rem` with `quotRem` when possible
-------------------------------------+-------------------------------------
              Reporter:  dfeuer      |            Owner:
                  Type:  feature     |           Status:  new
  request                            |        Milestone:
              Priority:  normal      |          Version:  7.9
             Component:  Compiler    |         Keywords:
            Resolution:              |     Architecture:  Unknown/Multiple
      Operating System:              |       Difficulty:  Unknown
  Unknown/Multiple                   |       Blocked By:
       Type of failure:              |  Related Tickets:
  None/Unknown                       |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 I think the dead code elimination is probably pretty simple here. If we
 see

 {{{#!hs
 case quotRemInt# x y of _ { (# q, r #) -> expr }
 }}}

 and either `q` or `r` is not free in `expr`, replace that with

 {{{#!hs
 case quotInt# x y of _ { q -> expr }
 }}}

 or the other way around. I don't know where code to do such a thing would
 belong, however. It certainly would have to be post-CSE.

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


More information about the ghc-tickets mailing list