
#9434: GHC.List.reverse does not fuse -------------------------------------+------------------------------------- Reporter: dfeuer | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: | Version: 7.9 libraries/base | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: | Difficulty: Easy (less than 1 Unknown/Multiple | hour) Type of failure: Runtime | Blocked By: performance bug | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by dfeuer): Replying to [comment:14 nomeata]:
Is this understanding correct: `reverse` is made a good consumer, and additionally, it is a good producer when immediately consumed by `map`.
It's made a good consumer, yes. It never becomes a good producer, per se; rather, it fuses with map to form something else that's not a good producer but fuses with map. The purpose of this is to shift the break we introduce in the fusion "pipeline" to the left in the hope that it will coalesce with another such break further on.
You might make the rules simpler by using `mapReverseFB revId` instead of `revFB`: No need to have both `mapMapReverse` and `mapReverse` then.
That's a good idea.
There is quite a bit of logic in this patch. Would you mind adding test cases for this, so that this behaviour is not accidentally broken in the future?
I can add some correctness tests for sure. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9434#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler