A Fresh Look at PRE as a Maximum Flow Problem

  • Jingling Xue
  • Jens Knoop
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3923)


We show that classic PRE is also a maximum flow problem, thereby revealing the missing link between classic and speculative PRE, and more importantly, establishing a common high-level conceptual basis for this important compiler optimisation. To demonstrate this, we formulate a new, simple unidirectional bit-vector algorithm for classic PRE based only on the well-known concepts of availability and anticipatability. Designed to find a unique minimum cut in a flow network derived from a CFG, which is proved simply but rigorously, our algorithm is simple and intuitive, and its optimality is self-evident. This conceptual simplicity also translates into efficiency, as validated by experiments.


Labelling Procedure Incoming Edge Optimal Transformation Redundant Computation Program Language Design 
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.


  1. 1.
    Bodik, R.: Path-Sensitive Value-Flow Optimizations of Programs. PhD thesis, University of Pittsburgh (1999)Google Scholar
  2. 2.
    Bodik, R., Gupta, R., Soffa, M.L.: Complete removal of redundant computations. In: Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation, pp. 1–14 (1998)Google Scholar
  3. 3.
    Briggs, P., Cooper, K.D.: Effective partial redundancy elimination. In: Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation, pp. 159–170 (1994)Google Scholar
  4. 4.
    Cai, Q., Xue, J.: Optimal and efficient speculation-based partial redundancy elimination. In: 1st IEEE/ACM International Symposium on Code Generation and Optimization, pp. 91–104 (2003)Google Scholar
  5. 5.
    Cormen, T.H., Leiserson, C.E., Rivest, R.L.: Introduction to Algorithms. MIT Press, Cambridge (1990)zbMATHGoogle Scholar
  6. 6.
    Dhamdhere, D.M.: A fast algorithm for code movement optimisation. SIGPLAN Not. 23(10), 172–180 (1988)CrossRefGoogle Scholar
  7. 7.
    Dhamdhere, D.M.: E-path_pre: partial redundancy elimination made easy. SIGPLAN Not. 37(8), 53–65 (2002)CrossRefGoogle Scholar
  8. 8.
    Dhaneshwar, V.M., Dhamdhere, D.M.: Strength reduction of large expressions. Journal of Programming Languages 3, 95–120 (1995)Google Scholar
  9. 9.
    Drechsler, K.-H., Stadel, M.P.: A variation on Knoop, Rüthing, and Steffen’s lazy code motion. SIGPLAN Notices 28(5), 29–38 (1993)CrossRefGoogle Scholar
  10. 10.
    Ford, L.R., Fulkerson, D.R.: Flows in Networks. Princeton University Press, Princeton (1962)zbMATHGoogle Scholar
  11. 11.
    Gupta, R., Berson, D.A., Fang, J.Z.: Path profile guided partial redundancy elimination using speculation. In: Proceedings of the 1998 International Conference on Computer Languages, pp. 230–239 (1998)Google Scholar
  12. 12.
    Hailperin, M.: Cost-optimal code motion. ACM Transactions on Programming Languages and Systems 20(6), 1297–1322 (1998)CrossRefGoogle Scholar
  13. 13.
    Horspool, R., Ho, H.: Partial redundancy elimination driven by a cost-benefit analysis. In: 8th Israeli Conference on Computer System and Software Engineering, pp. 111–118 (1997)Google Scholar
  14. 14.
    Hu, T.C.: Integer Programming and Network Flows. Addison-Wesley, Reading (1970)Google Scholar
  15. 15.
    Kennedy, R., Chan, S., Liu, S.-M., Lo, R., Tu, P.: Partial redundancy elimination in SSA form. ACM Transactions on Programming Languages and Systems 21(3), 627–676 (1999)CrossRefGoogle Scholar
  16. 16.
    Kennedy, R., Chow, F.C., Dahl, P., Liu, S.-M., Lo, R., Streich, M.: Strength reduction via SSAPRE. In: Proceedings of the 7th International Conference on Compiler Construction, London, UK, pp. 144–158. Springer, London (1998)CrossRefGoogle Scholar
  17. 17.
    Knoop, J., Rüthing, O., Steffen, B.: Lazy code motion. In: Proceedings of the ACM SIGPLAN 1992 Conference on Programming Language Design and Implementation, pp. 224–234 (1992)Google Scholar
  18. 18.
    Knoop, J., Rüthing, O., Steffen, B.: Lazy strength reduction. Journal of Programming Languages 1(1), 71–91 (1993)Google Scholar
  19. 19.
    Knoop, J., Rüthing, O., Steffen, B.: Optimal code motion: Theory and practice. ACM Trans. Program. Lang. Syst. 16(4), 1117–1155 (1994)CrossRefGoogle Scholar
  20. 20.
    Lin, J., Chen, T., Hsu, W.-C., Yew, P.-C., Ju, R.D.-C., Ngai, T.-F., Chan, S.: A compiler framework for speculative analysis and optimizations. In: Proceedings of the ACM SIGPLAN 2003 Conference on Programming Language Design and Implementation, pp. 289–299 (2003)Google Scholar
  21. 21.
    Lo, R., Chow, F., Kennedy, R., Liu, S.-M., Tu, P.: Register promotion by sparse partial redundancy elimination of loads and stores. SIGPLAN Not. 33(5), 26–37 (1998)CrossRefGoogle Scholar
  22. 22.
    Morel, E., Renvoise, C.: Global optimization by suppression of partial redundancies. Commun. ACM 22(2), 96–103 (1979)MathSciNetCrossRefzbMATHGoogle Scholar
  23. 23.
    Paleri, V.K., Srikant, Y.N., Shankar, P.: A simple algorithm for partial redundancy elimination. SIGPLAN Not. 33(12), 35–43 (1998)CrossRefzbMATHGoogle Scholar
  24. 24.
    Rüthing, O., Knoop, J., Steffen, B.: Sparse code motion. In: Conference Record of the 27th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Boston, Massachusetts, pp. 170–183. ACM, New York (2000)Google Scholar
  25. 25.
    Scholz, B., Horspool, R.N., Knoop, J.: Optimizing for space and time usage with speculative partial redundancy elimination. In: Proceedings of the 2004 ACM SIGPLAN/SIGBED Conference on Languages, Compilers, and Tools for Embedded Systems, pp. 221–230 (2004)Google Scholar
  26. 26.
    Xue, J., Cai, Q.: Profile-guided partial redundancy elimination using control speculation: a lifetime optimal algorithm and an experimental evaluation. Technical Report UNSW–CSE–TR–0420, School of Computer Science and Engigeering, University of New South Wales (July 2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Jingling Xue
    • 1
  • Jens Knoop
    • 2
  1. 1.Programming Languages and Compilers Group, School of Computer Science and EngineeringUniversity of New South WalesSydneyAustralia
  2. 2.Institut für ComputersprachenTechnische Universität WienWienAustria

Personalised recommendations