Fast Profile-Based Partial Redundancy Elimination

  • R. Nigel Horspool
  • David J. Pereira
  • Bernhard Scholz
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4228)


Partial Redundancy Elimination (PRE) is a standard program optimization which removes redundant computations via Code Motion. It subsumes and generalizes the optimizations of Global Common Subexpression Elimination (GCSE) and Loop Invariant Code Motion (LICM). Recent work has generalized PRE to become Speculative PRE (SPRE), which uses estimates of execution frequencies to find the optimal places in a program to perform computations. However, the analysis performed by the compiler is computationally intensive and hence impractical for just-in-time (JIT) compilers.

This paper introduces a novel approach which abandons a guarantee of optimality in favour of simplicity and speed of analysis. This new approach, called Isothermal SPRE, achieves results which are close to optimal in practice, yet its analysis time is at least as good as current compiler techniques for code motion. It is a technique suitable for use in JIT compilers.


Basic Block Compilation Time Compiler Optimization Conditional Branch Benchmark Program 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Aho, A., Sethi, R., Ullman, J.: Compilers: Principles, Techniques, and Tools. Addison-Wesley, Reading (1986)Google Scholar
  2. 2.
    Breuer, M.: Generation of optimal code for expressions via factorization. CACM 12(6), 333–340 (1969)zbMATHGoogle Scholar
  3. 3.
    Cai, Q., Xue, J.: Optimal and efficient speculation-based partial redundancy elimination. In: CGO 2003: Proceedings of the ACM/IEEE 2003 Symposium on Code Generation and Optimization, pp. 91–104 (2003)Google Scholar
  4. 4.
    Cocke, J.: Global common subexpression elimination. In: Proceedings of a symposium on compiler optimization, pp. 20–24 (1970)Google Scholar
  5. 5.
    Dhamdhere, D.: Practical adaptation of the global optimization algorithm of Morel and Renvoise. ACM Transactions on Programming Languages and Systems 13(2), 291–294 (1991)CrossRefGoogle Scholar
  6. 6.
    Horspool, R., Ho, H.: Partial redundancy elimination driven by a cost-benefit analysis. In: Proceedings of the 8th Israeli Conference on Computer Systems and Software Engineering, pp. 111–118 (1997)Google Scholar
  7. 7.
    Kam, J.B., Ullman, J.D.: Monotone data flow analysis frameworks. Acta Informatica 7, 309–317 (1977)CrossRefMathSciNetGoogle Scholar
  8. 8.
    Knoop, J., Ruthing, O., Steffen, B.: Lazy code motion. In: PLDI 1992: Proceedings of the ACM SIGPLAN 1992 conference on Programming Language Design and Implementation, pp. 224–234 (1992)Google Scholar
  9. 9.
    Knoop, J., Ruthing, O., Steffen, B.: Optimal code motion: theory and practice. ACM Transactions on Programming Languages and Systems 16(4), 1117–1155 (1994)CrossRefGoogle Scholar
  10. 10.
    Morel, E., Renvoise, C.: Global optimization by suppression of partial redundancies. CACM 22(2), 96–103 (1979)zbMATHMathSciNetGoogle Scholar
  11. 11.
    Morel, E., Renvoise, C.: Interprocedural elimination of partial redundancies. In: Muchnik, S., Jones, N. (eds.) Program Flow Analysis: Theory and Applications, pp. 160–188. Prentice-Hall, Englewood Cliffs (1981)Google Scholar
  12. 12.
    Muchnik, S.: Advanced Compiler Design and Implementation. Morgan Kaufmann, San Francisco (1997)Google Scholar
  13. 13.
    Scholz, B., Horspool, N., Knoop, J.: Optimizing for space and time usage with speculative partial redundancy elimination. In: LCTES 2004: Proceedings of ACM SIGPLAN/SIGBED 2004 Conference on Languages, Compilers, and Tools for Embedded Systems, pp. 221–230 (2004)Google Scholar
  14. 14.
    Standard Performance Evaluation Corporation. Cpu2000 (2006),
  15. 15.
    Stone, H.: Multiprocessor scheduling with the aid of network flow algorithms. IEEE Transactions on Software Engineering SE-3(1), 85–93 (1977)CrossRefGoogle Scholar
  16. 16.
    Wolfe, M.: Partial redundancy elimination is not bidirectional. SIGPLAN Notices 34(6), 43–46 (1999)CrossRefGoogle Scholar
  17. 17.
    Xue, J., Cai, Q.: A lifetime optimal algorithm for speculative pre. ACM Transactions on Architecture and Code Generation (to appear, 2006)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • R. Nigel Horspool
    • 1
  • David J. Pereira
    • 1
  • Bernhard Scholz
    • 2
  1. 1.Department of Computer ScienceUniversity of VictoriaVictoriaCanada
  2. 2.School of Information TechnologiesUniversity of SydneySydneyAustralia

Personalised recommendations