[GHC] #7367: Optimiser / Linker Problem on amd64
GHC
ghc-devs at haskell.org
Tue Aug 27 20:18:07 UTC 2013
#7367: Optimiser / Linker Problem on amd64
--------------------------------------------+------------------------------
Reporter: wurmli | Owner:
Type: bug | Status: new
Priority: normal | Milestone: 7.8.1
Component: Build System | Version: 7.6.1
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64
Type of failure: Runtime performance bug | (amd64)
Test Case: | Difficulty: Unknown
Blocking: | Blocked By:
| Related Tickets:
--------------------------------------------+------------------------------
Comment (by rwbarton):
Actually, `flopS` uses its "continuation" `f` linearly, like the CPS
translation of an ordinary imperative function. Teaching GHC to recognize
this sounds like quite an undertaking, though.
This seems like a typical instance of how it is hard to decide whether to
float out a let.
The trouble with let-floating from the user's perspective is that when GHC
wrongly decides to float out a let, it is virtually impossible to stop it
from doing so. One way out is `-fno-full-laziness`, but GHC probably was
correctly floating out a lot of other things, and it's difficult and
tedious to locate and transform all those parts of the code.
One suggestion is to identify situations in which let-floating can never
be harmful, and allow `-fno-full-laziness` (or perhaps a new flag,
`-fsome-full-laziness`?) to perform those floatings. For example, I don't
think it can ever cost to float a binding whose RHS is a lambda to the top
level. That rule would float out `flopp` and `swap` from `flop` here, and
compiling with `-fno-full-laziness` would then eliminate all allocations.
It would also be very useful to be able to control let-floating locally
with some kind of pragma or magic built-in function. I'm sure this idea
has been explored before and I also have some ideas of how to go about it,
but I want to get a little more familiar with the structure of GHC before
proposing anything.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7367#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list