Global value numbers and redundant computations

Most previous redundancy elilmination algorithms have been of two kinds. The lexical algorithms deal with the entire program, but they can only detect redundancy among computations of lexicatlly identical expressions, where expressions are lexically identical if they apply exactly the same operator to exactly the same operands. The value numbering algorithms,, on the other hand, can recognize redundancy among ex:pressions that are lexically different but that are certain to compute the same value. This is accomplished by assigning special symbolic names called value numbers to expr,essions. If the value numbers of the operands of two expressions are identical, and if the operators applied by the expressions are identical, then the expressions receive the: same value number and are certain to have the same values. Sameness of value numbers permits more extensive optimization than lexical identity, but value numbering algor:ithms have usually been restricted in the past to basic blocks (sequences of computations with no branching) or extended basic blocks (sequences of computations with no joins). We propose a redundancy elimination algorithm that is global (in that it deals with the entire program), yet able to recognize redundancy among expressions that are lexitally different. The al,gorithm also takes advantage of second order effects: transformations based on the discovery that two computations compute the same value may create opportunities to discover that other computations are equivalent. The algorithm applies to programs expressed as reducible [l] [9] control flow gratphs. As the examples in section 7 illustrate, our algorithm optimizes reducible programs much more extensively than previous algorithms. In the special case of a program without loops, the code generated by our algorithm is provably “optimal” in the technical sense explained in section 8. Thiis degree of optimization is

[1]  Edward S. Lowry,et al.  Object code optimization , 1969, CACM.

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

[3]  Robert M. Shapiro,et al.  THE REPRESENTATION OF ALGORITHMS , 1969 .

[4]  Frances E. Allen,et al.  Control-flow analysis , 2022 .

[5]  Sidney B. Gasser Program optimization , 1972, SICOSIM3.

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

[7]  Sidney B. Gasser Program optimization , 1972 .

[8]  Robert E. Tarjan Testing flow graph reducibility , 1973, STOC '73.

[9]  Jeffrey D. Ullman,et al.  Characterizations of Reducible Flow Graphs , 1974, JACM.

[10]  Jeffrey D. Ullman,et al.  A Simple Algorithm for Global Data Flow Analysis Problems , 1975, SIAM J. Comput..

[11]  Ross A. Faneuf,et al.  Program optimization - theory and practice , 1975 .

[12]  John H. Reif,et al.  Symbolic evaluation and the global value graph , 1977, POPL.

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

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

[15]  Barry K. Rosen Data Flow Analysis for Procedural Languages , 1979, JACM.

[16]  Gregory J. Chaitin,et al.  Register allocation and spilling via graph coloring , 2004, SIGP.

[17]  John L. Hennessy,et al.  Register allocation by priority-based coloring , 1984, SIGPLAN '84.

[18]  Ron Cytron,et al.  Code motion of control structures in high-level languages , 1986, POPL '86.

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

[20]  Martin Hopkins,et al.  An overview of the PL.8 compiler , 1982, SIGP.