DOI QR코드

DOI QR Code

A Practical Improvement to the Partial Redundancy Elimination in SSA Form

  • Park, Jong-Soo (Department of Electrical Engineering, Stanford University) ;
  • Lee, Jae-Jin (School of Computer Science and Engineering, Seoul National University)
  • 발행 : 2008.09.30

초록

Partial redundancy elimination (PRE) is an interesting compiler optimization because of its effectiveness and generality. Among many PRE algorithms, the one in static single assignment form (SSAPRE) has benefits over other bit-vector-based PRE algorithms. It preserves the properties of the SSA form after PRE and exploits the sparsity of the SSA form, resulting in reduced analysis and optimization time. This paper presents a practical improvement of the SSAPRE algorithm that further reduces the analysis and optimization time. The underlying idea is removing unnecessary ${\Phi}$'s during the ${\Phi}$-Insertion phase that is the first step of SSAPRE. We classify the expressions into three categories: confined expressions, local expressions, and the others. We show that unnecessary ${\Phi}$'s for confined and local expressions can be easily detected and removed. We implement our locality-based SSAPRE algorithm in a C compiler and evaluate its effectiveness with 20 applications from SPEC benchmark suites. In our measurements, on average 91 of ${\Phi}$'s identified by the original demand-driven SSAPRE algorithm are unnecessary for PRE. Pruning these unnecessary ${\Phi}$'s in the ${\Phi}$-Insertion phase makes our locality-based SSAPRE algorithm 1.8 times faster, on average, than the original SSAPRE algorithm.

키워드

참고문헌

  1. BODÍK, R., GUPTA, R., AND SOFFA, M. L. 1998. Complete Removal of Redundant Expressions. In Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation, 1-14.
  2. BRIGGS, P. AND COOPER, K. D. 1994. Effective Partial Redundancy Elimination. In Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation, 159-170.
  3. BRIGGS, P., COOPER, K. D., HARVEY, T. J., AND SIMPSON, L. T. 1998. Practical Improvements to the Construction and Destruction of Static Single Assignment Form. Software Practice and Experience, 28(8):859-881. https://doi.org/10.1002/(SICI)1097-024X(19980710)28:8<859::AID-SPE188>3.0.CO;2-8
  4. CAI, Q. AND XUE, J. 2003. Optimal and Efficient Speculation-Based Partial Redundancy Elimination. In Proceedings of the International Symposium on Code Generation and Optimization, 91-102.
  5. CHOI, J.-D., CYTRON, R., AND FERRANTE, J. 1991. Automatic Construction of Sparse Data Flow Evaluation Graphs. In Proceedings of the 18th ACM SIGPLAN-SIGACT symposium on Principles of Programming Languages, 55-66.
  6. CHOI, J.-D., SARKAR, V., AND SCHONBERG, E. 1996. Incremental computation of static single assignment form. In Proceedings of the 6th International Conference on Compiler Construction, 223-237.
  7. CHOW, F., CHAN, S., KENNEDY, R., LIU, S.-M., LO, R., AND TU, P. 1997. A New Algorithm for Partial Redundancy Elimination Based on SSA Form. In Proceedings of the ACM SIGPLAN 1997 conference on Programming Language Design and Implementation, 273-286.
  8. 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 Transactions on Programming Language and Systems, 13(4):451-490. https://doi.org/10.1145/115372.115320
  9. DHAMDHERE, D. M. 1988. A Fast Algorithm for Code Movement Optimization. ACM SIGPLAN Notices, 23(10):172-180. https://doi.org/10.1145/51607.51621
  10. DRECHSLER, K.-H. AND STADEL, M. P. 1993. A variation of Knoop, Ruthing, and Steffen's Lazy Code Motion. SIGPLAN Notices, 28(5):29-38.
  11. Inc. Edison Design Group. EDG C/C++ Compiler Front End. Website, 2005. http://www.edg.com.
  12. KENNEDY, K. 1972. Safety of Code Motion. International Journal of Computer Mathematics, 3(2 and 3):117-130. https://doi.org/10.1080/00207167208803056
  13. KENNEDY, R., CHAN, S., LIU, S.-M., LO, R., TU, P., AND CHOW, F. 1999. Partial Redundancy Elimination in SSA Form. ACM Transactions on Programming Language and Systems, 21(3):627-676. https://doi.org/10.1145/319301.319348
  14. 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, 144-158.
  15. KNOOP, J., RÜTHING, O., AND STEFFEN, B. 1992. Lazy Code Motion. In Proceedings of the ACM SIGPLAN 1992 conference on Programming Language Design and Implementation, 224-234.
  16. KNOOP, J., RÜTHING, O., AND STEFFEN, B. 1994. Optimal Code Motion: Theory and Practice. ACM Transactions on Programming Language and Systems, 16(4):1117-1155. https://doi.org/10.1145/183432.183443
  17. LENGAUER, T. AND TARJAN, R. E. 1979. A fast algorithm for finding dominators in a owgraph. ACM Transactions on Programming Language and Systems, 1(1):121-141. https://doi.org/10.1145/357062.357071
  18. 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 2003 Conference on Programming Language Design and Implementation, 289-299.
  19. LO, R., CHOW, F., KENNEDY, R., LIU, S.-M., AND TU, P. 1998. Register Promotion by Sparse Partial Redundancy Elimination of Loads and Stores. In Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation, 26-37.
  20. MOREL, E. AND RENVOISE, C. 1979. Global Optimization by Suppression of Partial Redundancies. Communications of ACM, 22(2):96-103. https://doi.org/10.1145/359060.359069
  21. MUCHNICK, S. S. 1997. Advanced Compiler Design and Implementation. Morgan Kaufmann Publishers, San Francisco.
  22. ODAIRA, R. AND HIRAKI, K. 2004. Partial Value Number Redundancy Elimination. In International Workshop on Languages and Compilers for Parallel Computing (LCPC'04), 409-423.
  23. ODAIRA, R. AND HIRAKI, K. 2005. Sentinel PRE: Hoisting beyond Exception Dependency with Dynamic Deoptimization. In Proceedings of the International Symposium on Code generation and Optimization, 328-338.
  24. PALERI, V. K., SRIKANT, Y. N., AND SHANKAR, P. 1998. A Simple Algorithm for Partial Redundancy Elimination. SIGPLAN Notices, 33(12):35-43.
  25. SCHOLZ, B., HORSPOOL, 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.
  26. SIMPSON, L. T. 1996. Value-Driven Redundancy Elimination. PhD thesis, Rice University.
  27. VANDRUNEN, T. AND HOSKING, A. 2004. Value-Based Partial Redundancy Elimination. In Proceedings of International Conference on Compiler Construction, 167-184.
  28. VANDRUNEN, T. AND HOSKING, A. L. 2004. Anticipation-based Partial Redundancy Elimination for Static Single Assignment Form. Software: Practice and Experience, 34(15):1413-1439. https://doi.org/10.1002/spe.618