[GHC] #3138: Returning a known constructor: GHC generates
terrible code for cmonad
GHC
trac at galois.com
Wed May 27 06:27:42 EDT 2009
#3138: Returning a known constructor: GHC generates terrible code for cmonad
-----------------------------------------+----------------------------------
Reporter: simonpj | Owner:
Type: run-time performance bug | Status: new
Priority: normal | Milestone: 6.12 branch
Component: Compiler | Version: 6.10.1
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Os: Unknown/Multiple
Architecture: Unknown/Multiple |
-----------------------------------------+----------------------------------
Changes (by simonpj):
* cc: lennart at augustsson.net (added)
Comment:
Lennart, I've taken a quick look. As you say, it generates quite a lot of
code. I attach the result of -ddump-simpl for `Inf.hs` compiled with -O.
There is indeed one function that return a simple constructor from a sum
type, namely `+=_r1mk`. Doing the CPR transform for this would indeed be a
significant improvement.
But is that it? Can you point to other lost optimisations? For example,
`while` is recursive so we can't inline that.
I'm sure you're right that we should get good code here, but because I
don't know the code, it's harder to spot what should be done that isn't
getting done. Can you help?
Simon
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3138#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list