case optimizations

Stephen Weeks MLton@sourcelight.com
Wed, 5 Dec 2001 12:13:31 -0800


Here are few notes I had about case optimizations I wanted to see.
I'm not sure if they fit into known-case or not.

case x of 
    A => LA
  | _ => (case x of 
             B => LB
           | C => LC
           | _ => LD)
-->
case x of
    A => LA
  | B => LB
  | C => LC
  | D => LD


case x of A => L1 | B => L2 | _ => L1
-->
case x of B => L2 | _ => L1


case x of A => L1 | B => L2 | C => L2
-->
case x of A => L1 | _ => L2  
if B and C are non-value-carrying