Value Numbering

Value numbering is a compiler-based program analysis method that allows redundant computations to be removed. This paper compares hash-based approaches derived from the classic local algorithm1 with partitioning approaches based on the work of Alpern, Wegman, and Zadeck2. Historically, the hash-based algorithm has been applied to single basic blocks or extended basic blocks. We have improved the technique to operate over the routine’s dominator tree. The partitioning approach partitions the values in the routine into congruence classes and removes computations when one congruent value dominates another. We have extended this technique to remove computations that define a value in the set of available expressions (AVAIL)3. Also, we are able to apply a version of Morel and Renvoise’s partial redundancy elimination4 to remove even more redundancies. The paper presents a series of hash-based algorithms and a series of refinements to the partitioning technique. Within each series, it can be proved that each method discovers at least as many redundancies as its predecessors. Unfortunately, no such relationship exists between the hash-based and global techniques. On some programs, the hash-based techniques eliminate more redundancies than the partitioning techniques, while on others, partitioning wins. We experimentally compare the improvements made by these techniques when applied to real programs. These results will be useful for commercial compiler writers who wish to assess the potential impact of each technique before implementation.

[1]  Alfred V. Aho,et al.  The Design and Analysis of Computer Algorithms , 1974 .

[2]  Etienne Morel,et al.  Global optimization by suppression of partial redundancies , 1979, CACM.

[3]  Michael A. Malcolm,et al.  Computer methods for mathematical computations , 1977 .

[4]  Bowen Alpern,et al.  Detecting equality of variables in programs , 1988, POPL '88.

[5]  Keith D. Cooper,et al.  Effective partial redundancy elimination , 1994, PLDI '94.

[6]  John H. Reif Symbolic program analysis in almost linear time , 1978, POPL '78.

[7]  Robert E. Tarjan,et al.  Depth-First Search and Linear Graph Algorithms , 1972, SIAM J. Comput..

[8]  John Cocke,et al.  Programming languages and their compilers: Preliminary notes , 1969 .

[9]  Jeffrey D. Ullman,et al.  Global Data Flow Analysis and Iterative Algorithms , 1976, J. ACM.

[10]  M. Wegman,et al.  Global value numbers and redundant computations , 1988, POPL '88.

[11]  Matthew S. Hecht,et al.  Flow Analysis of Computer Programs , 1977 .

[12]  Robert Paige,et al.  Look ma, no hashing, and no arrays neither , 1991, POPL '91.

[13]  Keith D. Cooper,et al.  Value-driven redundancy elimination , 1996 .

[14]  Keith D. Cooper,et al.  Combining analyses, combining optimizations , 1995, TOPL.

[15]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[16]  Mark N. Wegman,et al.  Efficiently computing static single assignment form and the control dependence graph , 1991, TOPL.

[17]  Robert E. Tarjan,et al.  A fast algorithm for finding dominators in a flowgraph , 1979, TOPL.

[18]  Mark N. Wegman,et al.  Constant propagation with conditional branches , 1985, POPL.

[19]  J. Cocke Global common subexpression elimination , 1970, Symposium on Compiler Optimization.