[project @ 2002-01-04 11:35:22 by simonpj]
authorsimonpj <unknown>
Fri, 4 Jan 2002 11:35:22 +0000 (11:35 +0000)
committersimonpj <unknown>
Fri, 4 Jan 2002 11:35:22 +0000 (11:35 +0000)
commit6346938ca4a1b2eacc29aae9d340c80a0057cd4c
treeb84a564a786ddd82e3dafca79090996cbe824fb4
parent4d2d47a58fc4bae0a12fdb37a9460d02cc3ac978
[project @ 2002-01-04 11:35:22 by simonpj]
----------------------------------------
Be a bit less gung ho about let-floating
----------------------------------------

Sometimes it's a bad idea to float cheap expressions
outwards, even if they escape a value lambda.

  -- Even if it escapes a value lambda, we only
  -- float if it's not cheap (unless it'll get all the
  -- way to the top).  I've seen cases where we
  -- float dozens of tiny free expressions, which cost
  -- more to allocate than to evaluate.
  -- NB: exprIsCheap is also true of bottom expressions, which
  --     is good; we don't want to share them
  --
  -- It's only Really Bad to float a cheap expression out of a
  -- strict context, because that builds a thunk that otherwise
  -- would never be built.  So another alternative would be to
  -- add
  --  || (strict_ctxt && not (exprIsBottom expr))
  -- to the condition above. We should really try this out.

The relevant function is lvlMFE, which has been subject to a lot
of fiddling over the years.  Probably this isn't the last time.

This all actually showed up when I was compiling IA.lhs from Ian Lynagh.
ghc/compiler/simplCore/SetLevels.lhs