[GHC] #13996: Non-cheap primop is duplicated
GHC
ghc-devs at haskell.org
Wed Jul 19 09:24:17 UTC 2017
#13996: Non-cheap primop is duplicated
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by mboes):
> better to push it inside the inner lambda, so the two lambdas come
together (generally a big win).
Note in particular that `-fno-lambda-eta-expansion` can be a huge
pessimization in the following way. Consider this program:
{{{#!hs
module Main where
f :: Double -> Double -> Double
f t = let s = sin t in \x -> x + s
main = do
print $ sum [ f t x | t <- [1..10000], x <- [1..10000]]
}}}
`ghc --make -O2` yields a program that runs in constant space. Whereas
adding `-fno-do-lambda-eta-expansion` to the command-line yields a program
that segfaults, because its memory consumption blew up and it ultimately
ran out of space.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13996#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list