Refactor the simplifier's treatment of case expressions
authorsimonpj@microsoft.com <unknown>
Fri, 9 Feb 2007 17:29:38 +0000 (17:29 +0000)
committersimonpj@microsoft.com <unknown>
Fri, 9 Feb 2007 17:29:38 +0000 (17:29 +0000)
commite9f23b4cc3df781f2fc84b48716a7779ecc8ab06
tree2ec6f1c221c6083ffc12c57390e46693113157f0
parent5bf1b7f5742ba6405239692f329e8be35491b350
Refactor the simplifier's treatment of case expressions

(NB: this patch could conceivably require some bits of the
following SpecConstr patch to compile cleanly.  It's conceptually
independent, but I'm not 100% certain that I've included all
the necessary bits here.)

This patch cleans up the simplifier's handling of various
otimisations for case expressions, notably
  - case elimination (discarding the case altogether)
  - merging identical alternatives
  - discarding impossible alternative
  - merging nested cases

Previously this was partly handled before, and partly after,
simplifying the case alternatives. The trouble with that is
that the dead-ness information on the case binders gets munged
during simplification, and that turned out to mean that
case elmination essentially never happened -- stupid.

Now I've moved it all to before simplifying the alterntives.
In fact this reduces the amount of code, I think, and it's
certainly tidier.  I don't think there is any loss.
compiler/simplCore/SimplUtils.lhs
compiler/simplCore/Simplify.lhs