Abstract
To derive maximum optimization benefits from partial redundancy elimination (PRE),it is necessary to go beyond its safety constraint. Algorithms for optimal speculative code motion have been developed based on the application of minimum cut to flow networks formed out of the control flow graph. These previous techniques did not take advantage of the SSA form, which is a popular program representation widely used in modern-day compilers. We have developed the MC-SSAPRE algorithm that enables an SSA-based compiler to take full advantage of SSA to perform optimal speculative code motion efficiently when an execution profile is available. Our work shows that it is possible to form flow networks out of SSA graphs, and the min-cut technique can be applied equally well on these flow networks to find the optimal code placement. We provide proofs of the correctness and computational and lifetime optimality of MC-SSAPRE. We analyze its time complexity to show its efficiency advantage. We have implemented MC-SSAPRE in the open-sourced Path64 compiler. Our experimental data based on the full SPEC CPU2006 Benchmark Suite show that MC-SSAPRE can further improve program performance over traditional SSAPRE, and that our sparse approach to the problem does result in smaller problem sizes.
- R. Bodik. Path-Sensitive Value-Flow Optimizations of Programs. PhD thesis, University of Pittsburgh, 1999. Google Scholar
Digital Library
- R. Bodik, R. Gupta, and M. L. Soffa. Complete removal of redundant expressions. In Proceedings of the ACM SIGPLAN '98 Conference on Programming Language Design and Implementation, pages 1--14, 1998. Google Scholar
Digital Library
- Q. Cai and J. Xue. Optimal and efficient speculation-based partial redundancy elimination. In Proceedings of the 2th annual IEEE/ACM international symposium on Code generation and optimization, pages 91--102, 2003. Google Scholar
Digital Library
- C. S. Chekuri, A. V. Goldberg, D. R. Karger, M. S. Levine, and C. Stein. Experimental study of minimum cut algorithms. In Proceedings of the Eighth Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 324--333, 1997. Google Scholar
Digital Library
- F. Chow, S. Chan, R. Kennedy, S. Liu, R. Lo, and P. Tu. A new algorithm for partial redundancy elimination based on ssa form. In Proceedings of the ACM SIGPLAN '97 Conference on Programming Language Design and Implementation, pages 273--286, 1997. Google Scholar
Digital Library
- R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Program. Lang. Syst., 13 (4): 451--490, 1991. ISSN 0164-0925. http://doi.acm.org/10.1145/115372.115320. Google Scholar
Digital Library
- L. Ford and D. Fulkerson. Flows in Networks. Princeton University Press, 1962.Google Scholar
- git://github.org/path64/compiler.git.Google Scholar
- R. Gupta, D. A. Berson, and J. Z. Fang. Path profile guided partial redundancy elimination using speculation, 1997.Google Scholar
- R. N. Horspool and H. Ho. Partial redundancy elimination driven by a cost-benefit analysis, 1997.Google Scholar
- R. N. Horspool, D. J. Pereira, and B. Scholz. Fast profile-based partial redundancy elimination. In Proceedings of the 7th Joint Modular Languages Conference, pages 362--376, September 2006. Google Scholar
Digital Library
- http://www.spec.org/cpu2006.Google Scholar
- K. Kennedy. Safety of code motion. International Journal of Computer Mathematics, 3 (2 and 3): 117--130, 1972.Google Scholar
- R. Kennedy, S. Chan, S. Liu, R. Lo, P. Tu, and F. Chow. Partial redundancy elimination in ssa form. ACM Trans. Program. Lang. Syst., 21 (3): 627--676, 1999. Google Scholar
Digital Library
- J. Knoop, O. Rüthing, and B. Steffen. Lazy code motion. In Proceedings of the ACM SIGPLAN '92 Conference on Programming Language Design and Implementation, pages 224--234, 1992. Google Scholar
Digital Library
- J. Knoop, O. Rüthing, and B. Steffen. Optimal code motion: theory and practice. ACM Trans. Program. Lang. Syst., 16 (4): 1117--1155, 1994. Google Scholar
Digital Library
- J. Lin, T. Chen, W. chung Hsu, and P. chung Yew. A compiler framework for speculative analysis and optimizations. In Proceedings of the ACM SIGPLAN '03 Conference on Programming Language Design and Implementation, pages 289--299, 2003. Google Scholar
Digital Library
- R. Lo, F. Chow, R. Kennedy, S. Liu, and P. Tu. Register promotion by sparse partial redundancy elimination of loads and stores. In Proceedings of the ACM SIGPLAN '98 Conference on Programming Language Design and Implementation, pages 26--37, 1998. Google Scholar
Digital Library
- E. Morel and C. Renvoise. Global optimization by suppression of partial redundancies. Communications of the ACM, 22 (2): 96--103, 1979. Google Scholar
Digital Library
- B. Murphy, V. Menon, F. Schneider, T. Shpeisman, and A. Adl-Tabatabai. Fault-safe code motion for type-safe languages. In Proceedings of the 6th annual IEEE/ACM international symposium on Code generation and optimization, pages 144--154, 2008. Google Scholar
Digital Library
- B. Scholz, N. Horspool, and J. Knoop. 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, pages 221--230, 2004. Google Scholar
Digital Library
- J. Xue and Q. Cai. A lifetime optimal algorithm for speculative pre. ACM Transactions on Architecture and Code Optimization, 3 (2): 115--155, 2006. Google Scholar
Digital Library
Index Terms
An SSA-based algorithm for optimal speculative code motion under an execution profile
Recommendations
Optimal code motion: theory and practice
An implementation-oriented algorithm for lazy code motion is presented that minimizes the number of computations in programs while suppressing any unnecessary code motion in order to avoid superfluous register pressure. In particular, this variant of ...
An SSA-based algorithm for optimal speculative code motion under an execution profile
PLDI '11: Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and ImplementationTo derive maximum optimization benefits from partial redundancy elimination (PRE),it is necessary to go beyond its safety constraint. Algorithms for optimal speculative code motion have been developed based on the application of minimum cut to flow ...
An evaluation of speculative instruction execution on simultaneous multithreaded processors
Modern superscalar processors rely heavily on speculative execution for performance. For example, our measurements show that on a 6-issue superscalar, 93% of committed instructions for SPECINT95 are speculative. Without speculation, processor resources ...







Comments