[project @ 2000-09-07 16:32:23 by simonpj]
authorsimonpj <unknown>
Thu, 7 Sep 2000 16:32:24 +0000 (16:32 +0000)
committersimonpj <unknown>
Thu, 7 Sep 2000 16:32:24 +0000 (16:32 +0000)
commit4e6d579860228f1264558d1cb03f27f239333039
tree94b828a92d8b05cafedae706aebf6a783e1b9df6
parente9f0fa8818a3c3b6bee9ff114dc773b21efab18a
[project @ 2000-09-07 16:32:23 by simonpj]
A list of simplifier-related stuff, triggered
by looking at GHC's performance.

I don't guarantee that this lot will lead to
a uniform improvement over 4.08, but it it should
be a bit better.  More work probably required.

* Make the simplifier's Stop continuation record whether the expression being
  simplified is the RHS of a thunk, or (say) the body of a lambda or case RHS.
  In the thunk case we want to be a bit keener about inlining if the type of
  the thunk is amenable to update in place.

* Fix interestingArg, which was being too liberal, and hence doing
  too much inlining.

* Extended CoreUtils.exprIsCheap to make two more things cheap:
    -  case (coerce x) of ...
    -   let x = y +# z
  This makes a bit more eta expansion happen.  It was provoked by
  a program of Marcin's.

* MkIface.ifaceBinds.   Make sure that we emit rules for things
  (like class operations) that don't get a top-level binding in the
  interface file.  Previously such rules were silently forgotten.

* Move transformRhs to *after* simplification, which makes it a
  little easier to do, and means that the arity it computes is
  readily available to completeBinding.  This gets much better
  arities.

* Do coerce splitting in completeBinding. This gets good code for
newtype CInt = CInt Int

test:: CInt -> Int
test x = case x of
          1 -> 2
          2 -> 4
          3 -> 8
          4 -> 16
          _ -> 0

* Modify the meaning of "arity" so that during compilation it means
  "if you apply this function to fewer args, it will do virtually
  no work".   So, for example
f = coerce t (\x -> e)
  has arity at least 1.  When a function is exported, it's arity becomes
  the number of exposed, top-level lambdas, which is subtly different.
  But that's ok.

  I removed CoreUtils.exprArity altogether: it looked only at the exposed
  lambdas.  Instead, we use exprEtaExpandArity exclusively.

  All of this makes I/O programs work much better.
ghc/compiler/basicTypes/Id.lhs
ghc/compiler/coreSyn/CoreFVs.lhs
ghc/compiler/coreSyn/CoreUnfold.lhs
ghc/compiler/coreSyn/CoreUtils.lhs
ghc/compiler/main/MkIface.lhs
ghc/compiler/simplCore/OccurAnal.lhs
ghc/compiler/simplCore/SetLevels.lhs
ghc/compiler/simplCore/SimplMonad.lhs
ghc/compiler/simplCore/SimplUtils.lhs
ghc/compiler/simplCore/Simplify.lhs
ghc/compiler/stranal/WorkWrap.lhs