Section: New Results
Fast computation of liveness sets
Participants : Benoit Boissinot, Alain Darte, Benoit Dupont-de-Dinechin [ Kalray ] , Fabrice Rastello.
We revisited the problem of computing liveness sets (live-in and live-out sets of basic blocks) for variables in strict SSA form programs. In strict SSA, the definition of a variable dominates all its uses, so the backward data-flow analysis for computing liveness sets can be simplified. Our first contribution was the design of a fast iterative data-flow algorithm, which exploits the SSA properties so that only two passes (backward, then forward) are necessary to compute liveness sets. Our solution relies on the use of a loop nesting forest (as defined by Ramalingam) and, unlike structure-based liveness algorithms, can handle any control-flow graph, even non-reducible. In SSA, a second – maybe more natural – approach is to identify, one path at a time, all paths from a use of a variable to its (unique) definition. Such a strategy is used in the LLVM compiler and in Appel's “Tiger book”. Our second contribution is to show how to extend and optimize these algorithms for computing the liveness sets, one variable at a time, with the adequate data structures.
Finally, we demonstrated and compared the efficiency of our solutions, for different data structures of liveness sets (bitsets and ordered sets), on the Spec CPU2006 programs in a production compiler. For our experiments, our solutions outperform standard data-flow liveness analysis, as we could expect. The two-passes data-flow algorithm is, in general, a bit slower than the algorithm that considers one variable at a time. More surprising, this latter algorithm can be easily extended to compute liveness sets for standard (i.e., non-SSA form) programs and is still faster than standard iterative data-flow liveness analysis. Nevertheless, some work remains to be done to finalize this preliminary experimental study.