patch applied (ghc): Refactor the simplifier'
s treatment of case expressions
Simon Peyton Jones
simonpj at microsoft.com
Fri Feb 9 12:41:32 EST 2007
Fri Feb 9 09:29:38 PST 2007 simonpj at microsoft.com
* 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.
M ./compiler/simplCore/SimplUtils.lhs -213 +135
M ./compiler/simplCore/Simplify.lhs -101 +162
More information about the Cvs-ghc