common-subexpression elimination (cse)

Stephen Weeks MLton@sourcelight.com
Tue, 24 Jul 2001 14:51:40 -0700


> I'm impressed.  What do you do in the CSE stuff to avoid getting confused
> about things that are delayed in a lambda?  I'm thinking of an expression
> which raises an exception, and so you can't lift it out if the lambda
> could be called in a context with a different handler.  Perhaps none of this
> is a problem with our first-order language.

I never move the first occurrence of an expression that may raise an expression.
I simply replace later occurrences by the variable that holds the result of the
first.