Common subexpression elemination (CSE)

Dinko Tenev dinko.tenev at gmail.com
Wed Nov 29 03:56:49 EST 2006


On 11/28/06, Mark T.B. Carroll <mark at ixod.org> wrote:
>
> "Dinko Tenev" <dinko.tenev at gmail.com> writes:
> (snip)
> > How exactly can CSE cause space leaks, and what does this have to do
> > with strictness?
>
> I puzzled over Lennart's comment too, and the theory I formed was that
> you might have the same expression used in different parts of a
> function, where the compiler hasn't realised that the remaining
> reference to the expression is in a part of the function that isn't
> going to be executed this time, so it is holding on to the expression's
> value even though it is never going to be used. (For instance, with a
> recursive function, all the previous calls may be holding on to their
> version of the value until the call stack has come back out past them
> again.)
>
> -- Mark
>
>
I see this as a special case of Lennart's point -- you're talking about
references that are practically dead (just not burried yet :)  The compiler
should probably be able to kill these early by a CPS transform, shouldn't
it?

-- 

Cheers,
    Dinko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20061129/782a3d66/attachment-0001.htm


More information about the Glasgow-haskell-users mailing list