CSE fails to CSE two identical large top-level functions
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?