Rüthing O., Knoop J., Steffen B. (1999) Detecting Equalities of Variables: Combining Efficiency with Precision. In: Cortesi A., Filé G. (eds) Static Analysis. SAS 1999. Lecture Notes in Computer Science, vol 1694. Springer, Berlin, Heidelberg
Detecting whether different variables have the same value at a program point is generally undecidable. Though the subclass of equalities, whose validity holds independently from the interpretation of operators (Herbrand-equivalences), is decidable, the technique which is most widely implemented in compilers, value numbering, is restricted to basic blocks. Basically, there are two groups of algorithms aiming at globalizations of value numbering: first, a group of algorithms based on the algorithm of Kildall, which uses data flow analysis to gather information on value equalities. These algorithms are complete in detecting Herbrand-equivalences, however, expensive in terms of computational complexity. Second, a group of algorithms influenced by the algorithm of Alpern, Wegman and Zadeck. They do not fully interpret the control flow, which allows them to be particularly efficient, however, at the price of being significantly less precise than their Kildall-like counterparts. In this article we discuss how to combine the best features of both groups by aiming at a fair balance between computational complexity and precision. We propose an algorithm, which extends the one of Alpern, Wegman and Zadeck. The new algorithm is polynomial and, in practice, expected to be almost as efficient as the original one. Moreover, for acyclic control flow it is as precise as Kildall’s one, i. e. it detects all Herbrand-equivalences.