[GHC] #14186: CSE fails to CSE

GHC ghc-devs at haskell.org
Tue Sep 5 13:49:12 UTC 2017


#14186: CSE fails to CSE
-------------------------------------+-------------------------------------
           Reporter:  nomeata        |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.3
           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 code:

 {{{
 module CSEBug where

 data Succs a = Succs a [a]

 instance Functor Succs where
     fmap f (Succs o s) = Succs (f o) (map f s)

 foo, bar :: (a -> b) -> (b -> c) -> Succs a -> Succs c
 foo f g x = fmap (g . f) x
 bar f g x = fmap (g . f) x
 }}}

 If I compile this with `-O`, `foo` and `bar` are not CSEd, which can be
 seen with `-ddump-cse`.

 Removing either the first or the second argument of `Succs` makes CSE
 work.

 Is there a size limit on CSE?

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


More information about the ghc-tickets mailing list