DeepFlatten is an optimization pass for the SSA2 IntermediateLanguage, invoked from SSA2Simplify.
Description
This pass flattens into mutable fields of objects and into vectors.
For example, an (int * int) ref is represented by a 2 word object, and an (int * int) array contains pairs of int-s, rather than pointers to pairs of int-s.
Implementation
Details and Notes
There are some performance issues with the deep flatten pass, where it consumes an excessive amount of memory.
A number of applications require compilation with -drop-pass deepFlatten to avoid exceeding available memory. It is often asked whether the deep flatten pass usually has a significant impact on performance. The standard benchmark suite was run with and without the deep flatten pass enabled when the pass was first introduced:
The conclusion is that it does not have a significant impact. However, these are micro benchmarks; other applications may derive greater benefit from the pass.