skip to main content
10.1145/1480881.1480915acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Equality saturation: a new approach to optimization

Authors Info & Claims
Published:21 January 2009Publication History

ABSTRACT

Optimizations in a traditional compiler are applied sequentially, with each optimization destructively modifying the program to produce a transformed program that is then passed to the next optimization. We present a new approach for structuring the optimization phase of a compiler. In our approach, optimizations take the form of equality analyses that add equality information to a common intermediate representation. The optimizer works by repeatedly applying these analyses to infer equivalences between program fragments, thus saturating the intermediate representation with equalities. Once saturated, the intermediate representation encodes multiple optimized versions of the input program. At this point, a profitability heuristic picks the final optimized program from the various programs represented in the saturated representation. Our proposed way of structuring optimizers has a variety of benefits over previous approaches: our approach obviates the need to worry about optimization ordering, enables the use of a global optimization heuristic that selects among fully optimized programs, and can be used to perform translation validation, even on compilers other than our own. We present our approach, formalize it, and describe our choice of intermediate representation. We also present experimental results showing that our approach is practical in terms of time and space overhead, is effective at discovering intricate optimization opportunities, and is effective at performing translation validation for a realistic optimizer.

References

  1. L. Almagor, K. D. Cooper, A. Grosul, T. J. Harvey, S. W. Reeves, D. Subramanian, L. Torczon, and T. Waterman. Finding effective compilation sequences. In LCTES, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. B. Alpern, M.Wegman, and F. Zadeck. Detecting equality of variables in programs. In POPL, January 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. E. A. Ashcroft and W. W. Wadge. Lucid, a nonprocedural language with iteration. Communications of the ACM, 20(7):519--526, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. S. Bansal and A. Aiken. Automatic generation of peephole superoptimizers. In ASPLOS, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. R. Bird and P. Wadler. Introduction to Functional Programming. Prentice Hall, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. James M. Boyle, Terence J. Harmer, and Victor L. Winter. The TAMPR program transformation system: simplifying the development of numerical software. Modern software tools for scientific computing, pages 353--372, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. M. Bravenboer, K. T. Kalleberg, R. Vermaas, and E. Visser. Stratego/XT 0.17. A language and toolset for program transformation. Science of Computer Programming, 72(1-2):52--70, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. K. D. Cooper C. Click. Combining analyses, combining optimizations. Transactions on Programming Languages and Systems, 17(2):181--196, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. C. Click. Global code motion/global value numbering. In PLDI, June 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. K. D. Cooper, P. J. Schielke, and Subramanian D. Optimizing for reduced code space using genetic algorithms. In LCTES, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. R. Cytron, J. Ferrante, B. Rosen, M. Wegman, and K. Zadeck. An efficient method for computing static single assignment form. In POPL, January 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Jeffrey Dean and Craig Chambers. Towards better inlining decisions using inlining trials. In Conference on LISP and Functional Programming, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. D. Detlefs, G. Nelson, and J. Saxe. Simplify: A theorem prover for program checking. Journal of the Association for Computing Machinery, 52(3):365--473, May 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. E. Dijkstra. Go to statement considered harmful. pages 27--33, 1979. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. J. Ferrante, K. Ottenstein, and J. Warren. The program dependence graph and its use in optimization. Transactions on Programming Languages and Systems, 9(3):319--349, July 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Christopher W. Fraser, Robert R. Henry, and Todd A. Proebsting. BURG: fast optimal instruction selection and tree parsing. SIGPLAN Notices, 27(4):68--76, April 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. J. Giarratano and G. Riley. Expert Systems -- Principles and Programming. PWS Publishing Company, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Torbjorn Granlund and Richard Kenner. Eliminating branches using a superoptimizer and the GNU C compiler. In PLDI, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. P. Havlak. Construction of thinned gated single-assignment form. In Workshop on Languages and Compilers for Parallel Computing, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. W. M. Johnston, J. R. P. Hanna, and R. J. Millar. Advances in dataflow programming languages. ACM Computing Surveys, 36(1):1--34, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. R. Joshi, G. Nelson, and K. Randall. Denali: a goal-directed superoptimizer. In PLDI, June 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. L. Torczon K. D. Cooper, D. Subramanian. Adaptive optimizing compilers for the 21st century. The Journal of Supercomputing, pages 7--22, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. S. Lerner, D. Grove, and C. Chambers. Composing dataflow analyses and transformations. In POPL, January 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Henry Massalin. Superoptimizer: a look at the smallest program. In ASPLOS, 1987. Google ScholarGoogle ScholarCross RefCross Ref
  25. G. Necula. Translation validation for an optimizing compiler. In PLDI, June 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. G. Nelson and D. Oppen. Simpliflication by cooperating decision procedures. Transactions on Programming Languages and Systems, 1(2):245--257, October 1979. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. G. Nelson and D. Oppen. Fast decision procedures based on congruence closure. Journal of the Association for Computing Machinery, 27(2):356--364, April 1980. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. K. Ottenstein, R. Ballance, and A. MacCabe. The program dependence web: a representation supporting control-, data-, and demand-driven interpretation of imperative languages. In PLDI, June 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. K. Pengali, M. Beck, and R. Johson. Dependence Flow graphs: an algebraic approach to program dependencies. In POPL, January 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. A. Pnueli, M. Siegel, and E. Singerman. Translation validation. In TACAS, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. H. Sheini and K. Sakallah. Pueblo: A hybrid pseudo-boolean SAT solver. Journal on Satisfiability, Boolean Modeling and Computation, 2:61--96, 2006.Google ScholarGoogle Scholar
  32. B. Steffen, J. Knoop, and O. Ruthing. The value flow graph: A program representation for optimal program transformations. In European Symposium on Programming, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Ross Tate, Michael Stepp, Zachary Tatlock, and Sorin Lerner. Translating between PEGs and CFGs. Technical Report CS2008-0931, University of California, San Diego, November 2008.Google ScholarGoogle Scholar
  34. P. Tu and D. Padua. Efficient building and placing of gating functions. In PLDI, June 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. R. Vallee-Rai, L. Hendren, V. Sundaresan, P. Lam, E. Gagnon, and P. Co. Soot -- a Java optimization framework. In CASCON, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. M. G. J. van den Brand, J. Heering, P. Klint, and P. A. Olivier. Compiling language definitions: the ASF+SDF compiler. Transactions on Programming Languages and Systems, 24(4), 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. E. Visser, Z. Benaissa, and A Tolmach. Building program optimizers with rewriting strategies. In ICFP, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. D. Weise, R. Crew, M. Ernst, and B. Steensgaard. Value dependence graphs: Representation without taxation. In POPL, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Debbie Whitfield and Mary Lou Soffa. An approach to ordering optimizing transformations. In PPOPP, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Deborah L. Whitfield and Mary Lou Soffa. An approach for exploring code improving transformations. Transactions on Programming Languages and Systems, 19(6):1053--1084, November 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. B. Xin, W. N. Sumner, and X. Zhang. Efficient program execution indexing. In PLDI, June 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Lenore Zuck, Amir Pnueli, Yi Fang, and Benjamin Goldberg. VOC: A methodology for the translation validation of optimizing compilers. Journal of Universal Computer Science, 9(3):223--247, March 2003.Google ScholarGoogle Scholar

Index Terms

  1. Equality saturation: a new approach to optimization

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      POPL '09: Proceedings of the 36th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
      January 2009
      464 pages
      ISBN:9781605583792
      DOI:10.1145/1480881
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 44, Issue 1
        POPL '09
        January 2009
        453 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1594834
        Issue’s Table of Contents

      Copyright © 2009 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 21 January 2009

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate824of4,130submissions,20%

      Upcoming Conference

      POPL '25

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader