skip to main content
article
Open access

A lifetime optimal algorithm for speculative PRE

Published: 01 June 2006 Publication History

Abstract

A lifetime optimal algorithm, called MC-PRE, is presented for the first time that performs speculative PRE based on edge profiles. In addition to being computationally optimal in the sense that the total number of dynamic computations for an expression in the transformed code is minimized, MC-PRE is also lifetime optimal since the lifetimes of introduced temporaries are also minimized. The key in achieving lifetime optimality lies not only in finding a unique minimum cut on a transformed graph of a given CFG, but also in performing a data-flow analysis directly on the CFG to avoid making unnecessary code insertions and deletions. The lifetime optimal results are rigorously proved. We evaluate our algorithm in GCC against three previously published PRE algorithms, namely, MC-PREcopt (Qiong and Xue's computationally optimal version of MC-PRE), LCM (Knoop, Rüthing, and Steffen's lifetime optimal algorithm for performing nonspeculative classic PRE), and CMP-PRE (Bodik, Gupta, and Soffa's PRE algorithm based on code-motion preventing (CMP) regions, which is speculative but not computationally optimal). We report and analyze our experimental results, obtained from both actual program execution and instrumentation, for all 22 C, C++ and FORTRAN 77 benchmarks from SPECcpu2000 on an Itanium 2 computer system. Our results show that MC-PRE (or MC-PREcopt) is capable of eliminating more partial redundancies than both LCM and CMP-PRE (especially in functions with complex control flow), and, in addition, MC-PRE inserts temporaries with shorter lifetimes than MC-PREcopt. Each of both benefits has contributed to the performance improvements in benchmark programs at the costs of only small compile-time and code-size increases in some benchmarks.

References

[1]
Alpern, B., Wegman, M. N., and Zadeck, F. K. 1988. Detecting equality of variables in programs. In Proceedings of the 15th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. 1--11.
[2]
Beszedes, A. 2003. Optimizing for space: Measurements and possibilities for improvement. In GCC Summit 2003.
[3]
Bodik, R. 1999. Path-sensitive value-flow optimizations of programs. Ph.D. thesis, University of Pittsburgh.
[4]
Bodik, R., Gupta, R., and Soffa, M. L. 1998. Complete removal of redundant computations. In Proceedings of the ACM SIGPLAN '98 Conference on Programming Language Design and Implementation. 1--14.
[5]
Briggs, P. and Cooper, K. D. 1994. Effective partial redundancy elimination. In Proceedings of the ACM SIGPLAN '94 Conference on Programming Language Design and Implementation. 159--170.
[6]
Cai, Q. and Xue, J. 2003. Optimal and efficient speculation-based partial redundancy elimination. In 1st IEEE/ACM International Symposium on Code Generation and Optimization. 91--104.
[7]
Chang, P. P., Mahlke, S. A., Chen, W. Y., Warter, N. J., and mei W. Hwu, W. 1991. Impact: An architectural framework for multiple-instruction-issue processors. In Proceedings of the 18th Annual International Symposium on Computer Architecture. 266--275.
[8]
Chekuri, C., Goldberg, A. V., Karger, D. R., Levine, M. S., and Stein, C. 1997. Experimental study of minimum cut algorithms. In Proceedings of the Eighth Annual ACM-SIAM Symposium on Discrete Algorithms. 324--333.
[9]
Chow, F. 1983. A portable machine-independent global optimizer---design and measurements. Ph.D. thesis, Computer Systems Laboratory, Stanford University.
[10]
Click, C. 1995. Global code motion/global value numbering. In Proceedings of the ACM SIGPLAN'95 Conference on Programming Language Design and Implementation (PLDI). 246--257.
[11]
Cormen, T. H., Leiserson, C. E., and Rivest, R. L. 1990. Introduction to Algorithms. MIT Press, Cambridge, MA.
[12]
Cytron, R., Ferrante, J., Rosen, B. K., Wegman, M. N., and Zadeck, F. K. 1991. Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Program. Lang. Syst. 13, 4, 451--490.
[13]
Dhamdhere, D. M. 1991. Practical adaptation of the global optimization algorithm of Morel and Renvoise. ACM Trans. Program. Lang. Syst. 13, 2, 291--294.
[14]
Dhamdhere, D. M., Rosen, B. K., and Zadeck, F. K. 1992. How to analyze large programs efficiently and informatively. In Proceedings of the ACM SIGPLAN'92 Conference on Programming Language Design and Implementation (PLDI). 212--223.
[15]
Drechsler, K.-H. and Stadel, M. P. 1993. A variation on Knoop, Rüthing, and Steffen's lazy-code motion. SIGPLAN Notices 28, 5, 29--38.
[16]
Fernández, M. and Espasa, R. 2004. Link-time path-sensitive memory redundancy elimination. In International Conference on High-Performance Computer Architecture. 300--310.
[17]
Ford, L. R. and Fulkerson, D. R. 1962. Flows in Networks. Princeton University Press, Princeton, NJ.
[18]
Goldberg, A. 2003. Network Optimization Library. http://www.avglab.com/andrew/soft.html.
[19]
Gupta, R., Berson, D. A., and Fang, J. Z. 1998. Path profile guided partial redundancy elimination using speculation. In Proceedings of the 1998 International Conference on Computer Languages. 230--239.
[20]
Hailperin, M. 1998. Cost-optimal code motion. ACM Transactions on Programming Languages and Systems 20, 6, 1297--1322.
[21]
Horspool, R. and Ho, H. 1997. Partial redundancy elimination driven by a cost-benefit analysis. In 8th Israeli Conference on Computer System and Software Engineering. 111--118.
[22]
Hosking, A. L., Nystrom, N., Whitlock, D., Cutts, Q. I., and Diwan, A. 2001. Partial redundancy elimination for access path expressions. Softw., Pract. Exper. 31, 6, 577--600.
[23]
Hu, T. C. 1970. Integer Programming and Network Flows. Addison-Wesley, Reading, MA.
[24]
Johnson, T. A., Eigenmann, R., and Vijaykumar, T. N. 2004. Min-cut program decomposition for thread-level speculation. SIGPLAN Not. 39, 6, 59--70.
[25]
Kennedy, K. 1972. Safety of code motion. International Journal of Computer Mathematics 3, 2--3, 117--130.
[26]
Kennedy, R., Chow, F. C., Dahl, P., Liu, S.-M., Lo, R., and Streich, M. 1998. Strength reduction via SSAPRE. In Proceedings of the 7th International Conference on Compiler Construction. Springer-Verlag, New York. 144--158.
[27]
Kennedy, R., Chan, S., Liu, S.-M., Lo, R., and Tu, P. 1999. Partial redundancy elimination in SSA form. ACM Transactions on Programming Languages and Systems 21, 3, 627--676.
[28]
Knoop, J. 1998. Optimal interprocedural program optimization: A new framework and its application. Number 1428 in LNCS.
[29]
Knoop, J. and Mehofer, E. 2002. Distribution assignment placement: Effective optimization of redistribution costs. IEEE Trans. Parallel Distrib. Syst. 13, 6, 628--647.
[30]
Knoop, J., Rüthing, O., and Steffen, B. 1992. Lazy code motion. In Proceedings of the ACM SIGPLAN '92 Conference on Programming Language Design and Implementation. 224--234.
[31]
Knoop, J., Rüthing, O., and Steffen, B. 1994. Optimal code motion: Theory and practice. ACM Trans. Program. Lang. Syst. 16, 4, 1117--1155.
[32]
Knoop, J., Collard, J.-F., and Ju, R. D.-C. 2000. Partial redundancy elimination on predicated code. In Proceedings of the 7th Static Analysis Symposium (SAS'00). 260--279.
[33]
Lin, J., Chen, T., Hsu, W.-C., Yew, P.-C., Ju, R. D.-C., Ngai, T.-F., and Chan, S. 2003. A compiler framework for speculative analysis and optimizations. In Proceedings of the ACM SIGPLAN '03 Conference on Programming Language Design and Implementation. 289--299.
[34]
Lo, R., Chow, F., Kennedy, R., Liu, S.-M., and Tu, P. 1998. Register promotion by sparse partial redundancy elimination of loads and stores. SIGPLAN Not. 33, 5, 26--37.
[35]
Morel, E. and Renvoise, C. 1979. Global optimization by suppression of partial redundancies. Commun. ACM 22, 2, 96--103.
[36]
Morgan, R. 1998. Building an Optimizing Compiler. Butterworth-Heinemann, London.
[37]
Muchnick, S. S. 1997. Advanced Compiler Design and Implementation. Morgan Kaufmann Publishers, Inc., San Francisco, CA, USA.
[38]
Rosen, B. K., Wegman, M. N., and Zadeck, F. K. 1988. Global value numbers and redundant computations. In Proceedings of the 15th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. 12--27.
[39]
Rüthing, O., Knoop, J., and Steffen, B. 2000. Sparse code motion. In Conference Record of the 27th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (Boston, Massachusetts). ACM, New York, 170--183.
[40]
Scholz, B., Horspool, R. N., and Knoop, J. 2004. 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. 221--230.
[41]
Simpson, L. T. 1996. Value-driven redundancy elimination. Ph.D. thesis, Rice University.
[42]
Steffen, B. 1996. Property-oriented expansion. In Proceedings of the 3rd Static Analysis Symposium (SAS'96). Lecture Notes in Computer Science, vol. 1145. Springer-Verlag, New York. 22--41.
[43]
Steffen, B., Knoop, J., and Rüthing, O. 1990. The value flow graph: A program representation for optimal program transformations. In Proceedings of the third European symposium on programming on ESOP '90. Springer-Verlag, New York, 389--405.
[44]
Steffen, B., Knoop, J., and Rüthing, O. 1991. Efficient code motion and an adaption to strength reduction. In TAPSOFT '91: Proceedings of the international joint conference on theory and practice of software development on Advances in distributed computing (ADC) and colloquium on combining paradigms for software development (CCPSD): Vol. 2. Springer-Verlag, New York, 394--415.
[45]
Sverre Jarp. 2002. A methodology for using the Itanium 2 performance counters for bottleneck analysis. http://www.gelato.org/pdf/Performance_counters_final.pdf.
[46]
Zhai, A., Colohan, C. B., Steffan, J. G., and Mowry, T. C. 2002. Compiler optimization of scalar value communication between speculative threads. In ASPLOS-X: Proceedings of the 10th International Conference on Architectural Support for Programming Languages and Operating Systems. ACM Press, New York. 171--183.

Cited By

View all
  • (2024)Faster Lifetime-Optimal Speculative Partial Redundancy Elimination for Goto-Free ProgramsDependable Software Engineering. Theories, Tools, and Applications10.1007/978-981-96-0602-3_21(382-398)Online publication date: 25-Nov-2024
  • (2023)Lazy Demand-driven Partial Redundancy EliminationJournal of Information Processing10.2197/ipsjjip.31.45931(459-468)Online publication date: 2023
  • (2022)Scalar Replacement Considering Branch DivergenceJournal of Information Processing10.2197/ipsjjip.30.16430(164-178)Online publication date: 2022
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Architecture and Code Optimization
ACM Transactions on Architecture and Code Optimization  Volume 3, Issue 2
June 2006
115 pages
ISSN:1544-3566
EISSN:1544-3973
DOI:10.1145/1138035
Issue’s Table of Contents
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: 01 June 2006
Published in TACO Volume 3, Issue 2

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Partial redundancy elimination
  2. classic PRE
  3. computational optimality
  4. data-flow analysis
  5. lifetime optimality
  6. speculative PRE

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)44
  • Downloads (Last 6 weeks)8
Reflects downloads up to 08 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Faster Lifetime-Optimal Speculative Partial Redundancy Elimination for Goto-Free ProgramsDependable Software Engineering. Theories, Tools, and Applications10.1007/978-981-96-0602-3_21(382-398)Online publication date: 25-Nov-2024
  • (2023)Lazy Demand-driven Partial Redundancy EliminationJournal of Information Processing10.2197/ipsjjip.31.45931(459-468)Online publication date: 2023
  • (2022)Scalar Replacement Considering Branch DivergenceJournal of Information Processing10.2197/ipsjjip.30.16430(164-178)Online publication date: 2022
  • (2021)lospre in linear timeProceedings of the 24th International Workshop on Software and Compilers for Embedded Systems10.1145/3493229.3493304(35-41)Online publication date: 1-Nov-2021
  • (2021)Automatic Synthesis of Data-Flow AnalyzersStatic Analysis10.1007/978-3-030-88806-0_22(453-478)Online publication date: 17-Oct-2021
  • (2016)Register allocation and spilling using the expected distance heuristicSoftware—Practice & Experience10.1002/spe.239346:11(1499-1523)Online publication date: 1-Nov-2016
  • (2014)Loop scheduling with memory access reduction subject to register constraints for DSP applicationsSoftware—Practice & Experience10.1002/spe.218644:8(999-1026)Online publication date: 1-Aug-2014
  • (2014)Predicting Voluntary and Involuntary Readmissions to Forensic Hospitals by Insanity Acquittees in MarylandBehavioral Sciences & the Law10.1002/bsl.213632:5(627-640)Online publication date: 20-Oct-2014
  • (2013)Minimizing code size via page selection optimization on partitioned memory architecturesProceedings of the 2013 International Conference on Compilers, Architectures and Synthesis for Embedded Systems10.5555/2555729.2555741(1-10)Online publication date: 29-Sep-2013
  • (2013)Minimizing code size via page selection optimization on partitioned memory architectures2013 International Conference on Compilers, Architecture and Synthesis for Embedded Systems (CASES)10.1109/CASES.2013.6662516(1-10)Online publication date: Sep-2013
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media