[MLton] leaf inlining

Matthew Fluet fluet at tti-c.org
Sun Jun 24 20:46:51 PDT 2007


Matthew Fluet wrote:
> I'm experimenting with tweaking the initial 
> leafInline optimization to execute more than once, so that more of these 
> small functions get inlined.

I've uploaded an extensive set of benchmarks to
   http://www.mlton.org/PortStatus

Currently, the default SSA optimization sequence begins with:
   removeUnused
   leafInline {size = 20}
   contify

Under the experiment above, the SSA optimization sequence begins with:
   removeUnused
   introduceLoops
   leafInline {size = size1}
   leafInline {size = size2}
   leafInline {size = size3}
   contify

The -inline-leaf (<n1>;<n2>;<n3>) option sets size1, size2, and size3. 
Hence, the default SSA optimization sequence can be recovered with the 
options -drop-pass introduceLoops1 -inline-leaf (20;0;0).  In each of 
the benchmark runs, MLton0 corresponds to the default SSA optimization 
sequence.

I added an introduceLoops pass before inlining, since inlining can't be 
applied to recursive functions (and recursive functions aren't leaf).

There's a lot of data there, but it seems that a little more inlining 
would be profitable.  I'm tempted to move the default to either MLton12 
(-inline-leaf (40;40;0)) or MLton14 (-inline-leaf (40;20;0)), especially 
if the few slowdowns can be explained and mitigated.




More information about the MLton mailing list