[GHC] #13156: CSE missing an easy case

GHC ghc-devs at haskell.org
Fri Jan 20 11:37:50 UTC 2017


#13156: CSE missing an easy case
-------------------------------------+-------------------------------------
           Reporter:  simonpj        |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:  8.2.1
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Consider this Core:
 {{{
 case f @Int of { r1 ->
 case f @Int of { r2 -> ...
 }}}
 There is an easy common sub-expression to be had here, which would allow
 to eliminate a case expression, but CSE didn't spot it in GHC 8.

 Easy to fix.  Here's an example that shows it
 {{{
 module Bug where

 f g x = let r :: [a] -> [a]
             r = case g x of True  -> reverse . reverse
                             False -> reverse
         in
         r `seq` r `seq` True
 }}}

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


More information about the ghc-tickets mailing list