[MLton] Int Overflow detection

Matthew Fluet fluet@cs.cornell.edu
Sun, 20 Mar 2005 16:51:17 -0500 (EST)

>> And given the high tech representations that mlton has perhaps some
>> of these optimizations would not be incredibly difficult to
>> implement.
> Unfortunately, we haven't taken advantage of loops nearly as much as
> we should have.  Some folks gave a pretty good try at implement
> SSA-PRE in MLton, which in principle should enable a lot of code
> motion.  But it never got beyond the experimental stage.

I agree that SSA-PRE in MLton would be very beneficial; although, I will 
point out that the loop invariant code that was identified in the 
assembly does not correspond to loop invariant's at the SSA or SSA2 ILs. 
In the assembly, it corresponded to extracting the array pointer from the 
ML stack; because stack allocated variables are never assumed to be in 
registers across basic blocks, we do the extraction each time around the 
loop.  This is a limitation of the native codegen, and there is the option 
to treat stack allocated variables as candidates for register allocation 
across basic blocks, but it slows down the codegen by a considerable