[GHC] #14186: CSE fails to CSE two identical large top-level functions
GHC
ghc-devs at haskell.org
Mon Sep 11 21:54:59 UTC 2017
#14186: CSE fails to CSE two identical large top-level functions
-------------------------------------+-------------------------------------
Reporter: nomeata | Owner: (none)
Type: bug | Status: patch
Priority: normal | Milestone:
Component: Compiler | Version: 8.3
Resolution: | Keywords: CSE
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: #13589 | Differential Rev(s): Phab:D3939
Wiki Page: |
-------------------------------------+-------------------------------------
Changes (by bgamari):
* keywords: => CSE
* related: => #13589
Old description:
> 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?
New description:
Consider this code:
{{{#!hs
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?
--
Comment:
#131589 is also somewhat relevant here.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14186#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list