case optimizations

Jagannathan, Suresh Suresh.Jagannathan@storagenetworks.com
Mon, 10 Dec 2001 14:16:15 -0500



...
> The more troubling cases are when we have blocks like
>  LX (??) = 
>    s1
>    s2
>    ...
>    sN
>    case x of A => LA | B => LB | ... | _ => LD
> 
> If there is a place where x is known to be an A and place where x is known
> to be B, then do we want to duplicate s1...sN?  Maybe up to some small
> value of N, but certainly not in all cases.

> Yeah, I'd leave this out for now, but I agree it is useful.  I
> remember Richard Kelsey talking about this years ago at NEC, but I
> don't remember anything concrete.  Henry or Suresh, any pointers or
> ideas?

Yes, I remember having these discussions with Richard on case optimizations
for Scheme 48.  I think our conclusion was that for small block sizes and
small numbers of blocks, this would be a worthwhile thing to do, but it was
never incorporated into Scheme 48.  Our Java compiler did perform this case
optimization on the SSA representation, but it tried to reduce code size
increase by
hoisting (sharing) blocks whenever possible.  I'll try to look up statistics
to see how effective it was, but as I recall it was only marginally useful
since the corresponding analysis oftentimes could not infer precise values
for x in this context-sensitive way.

-- sj