Skip to main content

An Unfolding-Based Loop Optimization Technique

  • Conference paper
Software and Compilers for Embedded Systems (SCOPES 2003)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2826))

Included in the following conference series:

Abstract

Loops in programs are the source of many optimizations for improving program performance, particularly on modern high-performance architectures as well as vector and multithreaded systems. Techniques such as loop invariant code motion, loop unrolling and loop peeling have demonstrated their utility in compiler optimizations. However, many of these techniques can only be used in very limited cases when the loops are ”well-structured” and easy to analyze. For instance, loop invariant code motion works only when invariant code is inside loops; loop unrolling and loop peeling work effectively when the array references are either constants or affine functions of index variable. It is our contention that there are many opportunities overlooked by limiting the optimizations to well structured loops. In many cases, even ”badly-structured” loops may be transformed into well structured loops. As a case in point, we show how some loop-dependent code can be transformed into loop-invariant code by transforming the loops. Our technique described in this paper relies on unfolding the loop for several initial iterations such that more opportunities may be exposed for many other existing compiler optimization techniques such as loop invariant code motion, loop peeling, loop unrolling, and so on.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison-Wesley, Reading (1986)

    Google Scholar 

  2. Allen, R., Kennedy, K.: Optimization Compilers for Modern Architectures. Morgan Kaufmann Publishers, San Francisco (2002)

    Google Scholar 

  3. August, D.I.: Hyperblock performance optimizations for ILP processors, M.S. thesis, Department of Electrical and Computer Engineering, University of Illinois, Urbana, IL (1996)

    Google Scholar 

  4. Bacon, D.F., Graham, S.L.: Compiler transformations for high-performance computing. ACM Computing Surveys 26(4), 345–420 (1994)

    Article  Google Scholar 

  5. Banerjee, U.: An introduction to a formal theory of dependence analysis. Journal of Supercomput 2(2), 133–149 (1988)

    Article  Google Scholar 

  6. Bodik, R., Gupta, R., Soffa, M.L.: Complete removal of redundant expressions. In: Prod. ACM Conf. On Programming Language Design and Implementation, pp. 1–14. ACM Press, New York (1998)

    Google Scholar 

  7. Bulyonkov, M.A., Kochetov, D.V.: Practical aspects of specialization of Algol-like programs. In: Danvy, O., Thiemann, P., Glück, R. (eds.) Dagstuhl Seminar 1996. LNCS, vol. 1110, pp. 17–32. Springer, Heidelberg (1996)

    Google Scholar 

  8. Cocke, J., Schwartz, J.T.: Programming languages and their compilers (preliminarynotes). 2nd Courant Institute of Mathematical Science. New York University, New York

    Google Scholar 

  9. Cytron, R., Ferrante, J.: Efficiently computing static single assignment form and the control dependence graph. ACM TOPLAS 13(4), 451–490 (1991)

    Article  Google Scholar 

  10. Cytron, R., Lowry, A., Zadeck, F.K.: Code motion of control structures in high-level languages. In: Conference Record of the 13th ACM Symposium on Principle of Programming Languages, pp. 70–85. ACM Press, New York (1986)

    Google Scholar 

  11. Dongarra, J., Hind, A.R.: Unrolling loops in Fortran. Softw. Pract. Exper. 9(3), 219–226 (1979)

    Article  MATH  Google Scholar 

  12. Ellis, J.R.: Building: A Compiler for VLIW Architecture. In: ACM Doctoral Dissertation Award. MIT Press, Cambridge (1986)

    Google Scholar 

  13. Floyd, R.W.: Algorithm 97: Shortest path. Communications of the ACM 5(6), 345 (1962)

    Article  Google Scholar 

  14. Kavi, K.M., Giorgi, R., Arul, J.: Scheduled Dataflow: Execution paradigm, architecture and performance evaluation. IEEE Transactions on Computer 50(8), 834–846 (2001)

    Google Scholar 

  15. Lin, D.C.: Compiler support for predicated execution in superscalar processors. M.S.thesis, Department of Electrical and Computer Engineering, University of Illinois, Urbana, IL (1992)

    Google Scholar 

  16. Mahlke, S.A.: Exploiting instruction level parallelism in the presence of conditional branches. Ph.D. thesis, Department of Electrical and Computer Engineering, University of Illinois, Urbana, IL (1995)

    Google Scholar 

  17. Metzger, R., Stroud, S.: Interprocedual constant propagation: An empirical study. ACM Letters on Programming Languages and Systems 2(1), 213–232 (1993)

    Article  Google Scholar 

  18. Padua, D.A., Wolfe, M.J.: Advanced compiler optimizations for supercomputers. Communications of the ACM 29(12), 1184–1201 (1986)

    Article  Google Scholar 

  19. Pande, S., Agrawal, D.P. (eds.): Compiler Optimizations for Scalable Parallel Systems. LNCS, vol. 1808. Springer, Heidelberg (1998)

    Google Scholar 

  20. Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Global value numbers and redundant computations. In: Conference Record of the 15th ACM Symposium on Principles of Programming Languages, pp. 12–27. ACM Press, New York (1988)

    Google Scholar 

  21. Song, L.: Studies on Termination Methods of Partial Evaluation. Ph.D. thesis, Department of Computer Science, Waseda University, Tokyo, Japan (2001)

    Google Scholar 

  22. Steffen, B.: Property oriented expansion. In: Cousot, R., Schmidt, D.A. (eds.) SAS 1996. LNCS, vol. 1145, pp. 22–41. Springer, Heidelberg (1996)

    Google Scholar 

  23. Steffen, B., Knoop, J., Rüthing, O.: The value flow graph: A program representation for optimal program transformations. In: Jones, N.D. (ed.) ESOP 1990. LNCS, vol. 432, pp. 389–405. Springer, Heidelberg (1990)

    Google Scholar 

  24. Warshall, S.: A theorem on Boolean matrices. Journal of the ACM 9(1), 11–12 (1962)

    Article  MATH  MathSciNet  Google Scholar 

  25. Wolfe, M.J.: Optimizing supercompilers for supercomputers. In: Research Monographs in Parallel and Distributed Computing, MIT Press, Cambridge

    Google Scholar 

  26. Wolfe, M.J.: High performance compilers for parallel computing. Addison-Wesley Publishing Company, Inc., Reading (1996)

    MATH  Google Scholar 

  27. Zima, H., Chapman, B.: Supercompiler for parallel and vector computers. Frontier, Series. ACM Press, New York (1990)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2003 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Song, L., Kavi, K., Cytron, R. (2003). An Unfolding-Based Loop Optimization Technique. In: Krall, A. (eds) Software and Compilers for Embedded Systems. SCOPES 2003. Lecture Notes in Computer Science, vol 2826. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-39920-9_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-39920-9_9

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-20145-8

  • Online ISBN: 978-3-540-39920-9

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics