A Polynomial-Time Algorithm for Global Value Numbering

  • Sumit Gulwani
  • George C. Necula
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3148)

Abstract

We describe a polynomial-time algorithm for global value numbering, which is the problem of discovering equivalences among program sub-expressions. We treat all conditionals as non-deterministic and all program operators as uninterpreted. We show that there are programs for which the set of all equivalences contains terms whose value graph representation requires exponential size. Our algorithm discovers all equivalences among terms of size at most s in time that grows linearly with s. For global value numbering, it suffices to choose s to be the size of the program. Earlier deterministic algorithms for the same problem are either incomplete or take exponential time.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Alpern, B., Wegman, M.N., Zadeck, F.K.: Detecting equality of variables in programs. In: 15th Annual ACM Symposium on Principles of Programming Languages, pp. 1–11. ACM, New York (1988)CrossRefGoogle Scholar
  2. 2.
    Click, C.: Global code motion/global value numbering. In: Proccedings of the ACM SIGPLAN 1995 Conference on Programming Language Design and Implementation, June 1995, pp. 246–257 (1995)Google Scholar
  3. 3.
    Cousot, P., Cousot, R.: Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: 4th Annual ACM Symposium on Principles of Programming Languages, pp. 234–252 (1977)Google Scholar
  4. 4.
    Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems 13(4), 451–490 (1990)CrossRefGoogle Scholar
  5. 5.
    Gargi, K.: A sparse algorithm for predicated global value numbering. In: Proceedings of the ACM SIGPLAN 2002 Conference on Programming Language Design and Implementation, June 17-19, vol. 37(5), pp. 45–56. ACM Press, New York (2002)CrossRefGoogle Scholar
  6. 6.
    Gulwani, S., Necula, G.C.: Global value numbering using random interpretation. In: 31st Annual ACM Symposium on POPL, January 2004, ACM, New York (2004)Google Scholar
  7. 7.
    Kildall, G.A.: A unified approach to global program optimization. In: 1st ACM Symposium on Principles of Programming Language, October 1973, pp. 194–206 (1973)Google Scholar
  8. 8.
    Muchnick, S.S.: Advanced Compiler Design and Implementation. Morgan Kaufmann, San Francisco (2000)Google Scholar
  9. 9.
    Necula, G.C.: Translation validation for an optimizing compiler. In: Proceedings of the ACM SIGPLAN ’00 Conference on Programming Language Design and Implementation, June 2000. ACM SIGPLAN, pp. 83–94 (2000)Google Scholar
  10. 10.
    Pnueli, A., Siegel, M., Singerman, E.: Translation validation. In: Steffen, B. (ed.) TACAS 1998. LNCS, vol. 1384, pp. 151–166. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  11. 11.
    Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Global value numbers and redundant computations. In: 15th Annual ACM Symposium on Principles of Programming Languages, pp. 12–27. ACM, New York (1988)CrossRefGoogle Scholar
  12. 12.
    Rüthing, O., Knoop, J., Steffen, B.: Detecting equalities of variables: Combining efficiency with precision. In: Cortesi, A., Filé, G. (eds.) SAS 1999. LNCS, vol. 1694, pp. 232–247. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  13. 13.
    Wegman, M.N., Zadeck, F.K.: Constant propagation with conditional branches. ACM Transactions on Programming Languages and Systems 13(2), 181–210 (1991)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Sumit Gulwani
    • 1
  • George C. Necula
    • 1
  1. 1.University of CaliforniaBerkeley

Personalised recommendations