skip to main content
10.5555/3049832.3049857acmconferencesArticle/Chapter ViewAbstractPublication PagescgoConference Proceedingsconference-collections
Article

Incremental whole program optimization and compilation

Published: 04 February 2017 Publication History

Abstract

Most modern compilers for statically typed high level languages perform whole program optimization and compilation in order to generate highly optimized code. Whole program analysis and optimization has the advantage of providing the compiler with visibility to the entire program. This allows information to be propagated across procedures to improve the quality of the generated code. The main disadvantage of existing systems with this capability however, is that recompiling a program after an edit incurs the cost of reanalyzing and regenerating code for all functions.
Compiler throughput is crucial for developers' everyday edit-compile-test cycle as well as build lab's automated rolling build. Improving the throughput of such builds significantly improves developer productivity and lab efficiency.
We present a practical and extensible framework for incremental whole program optimization (WPO) and compilation. It uses two program abstractions, namely a dependence graph representing the program entities that the code for each function depends upon, and lattices of data-flow information that affect the code generated. These abstractions are used to minimize the number of functions that must be reanalyzed and recompiled after a program edit. The framework uses a simple and fast checksum technique for detecting edits to functions and variables, and experimental evidence that this technique works well in practice. We also present a novel mechanism for achieving the no code generation diff requirement in the presence of multi-level inline expansion.
The system has been successfully implemented in the state-of-the-art commercial quality Visual C/C++ compiler and achieves up to 7X compilation speedup for typical edits.

References

[1]
F. E. Allen and J. Cocke. A program data flow analysis procedure. Journal of the Association for Computing Machinery, 19-3:137–147, March 1976.
[2]
L. O. Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, Sweden, 1994.
[3]
P. Andersson. Evaluation of inlining heuristics in industrial strength compilers for embedded systems. Master’s thesis, Department of Information Technology, Uppsala University, Uppsala, Sweden, 2009.
[4]
J. Barlow, S. Leung, M. Nearhos, and D. Purdue. Pecan programming environment user guide. Technical report, Department of Computer Science, Australian National University, Canberra, Australia, November 1986.
[5]
J. M. Barth. An interprocedural data flow analysis algorithm. In Proceedings of the 4th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages. ACM, January 1977.
[6]
H. V. Braden and W. A. Wulf. The implementation of a basic system in a multiprogramming environment. Communications of the ACM, 11(10):688–692, October 1968.
[7]
P. Briggs, D. Evans, B. Grant, and R. Hundt. WHOPR - fast and scalable whole program optimizations in GCC, 2007.
[8]
M. Burke. An interval-based approach to exhaustive and incremental interprocedural data-flow analysis. Communications of the ACM, 12(3):341–395, July 1990.
[9]
M. Burke and L. Torczon. Interprocedural optimization: Eliminating unnecessary recompilation. ACM Transactions on Programming Languages and Systems (TOPLAS), 15(3): 367–399, July 1993.
[10]
M. G. Burke and B. G. Ryder. A critical analysis of incremental iterative data flow analysis algorithms. IEEE Transactions on Software Engineering, 16(7):723–728, July 1990.
[11]
C. Chambers, J. Dean, and D. Grove. A framework for selective recompilation in the presence of complex intermodule dependecies. In Proceedings of the 17th International Conference on Software Engineering, pages 221–230. ACM, April 1995.
[12]
W. Y. Chen, P. P. Chang, T. M. Conte, and W. M. Hwu. The effect of code expanding optimizations on instruction cache design. IEEE Transactions on Computers, 42(9):1045–1057, Sept. 1993.
[13]
B. A. Davey and H. A. Priestley. Introduction to Lattices and Order. Cambridge University Press, second edition edition, 2002.
[14]
Google. Correct, reproducible, fast builds for everyone, 2015.
[15]
W. G. Griswold. Direct update of data flow representations for a meaning-preserving program restructuring tool. In Proceedings of the 1st ACM SIGSOFT Symposium on Foundations of Software Engineering, pages 42–55. ACM, December 1993.
[16]
M. S. Hecht and J. D. Ullman. A simple algorithm for global data flow analysis problems. In Proceedings of the 1st Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages (POPL), pages 194–206. ACM, October 1973.
[17]
K. Jensen and N. Wirth. Pascal User Manual and Report. Springer-Verlag, New York, 1978. ISBN 0-387-90144-2.
[18]
T. Johnson and X. D. Li. ThinLTO: A fine-grained demanddriven infrastructure, 2015.
[19]
N. D. Jones and S. S. Muchnick. A flexible approach to interprocedural data flow analysis and programs with recursive data structures. In Proceedings of the 9th ACM Symposium on Principles of Programming Languages, pages 66–74. ACM, 1982.
[20]
H. Katzan Jr. Batch, conversational, and incremental compilers. In 1969 Spring Joint Computer Conference, AFIPS Conference Proceedings, volume 34, pages 47–56. AFIPS Press, 1969.
[21]
G. A. Kildall. A unified approach to global program optimization. In Proceedings of the 1st Annual ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pages 194–206. ACM, 1973.
[22]
X. Li, R. Ashok, and R. Hundt. LIPO - profile feedback based lightweight IPO, 2013.
[23]
R. Medina-Mora and P. H. Feiler. An incremental programming environment. IEEE Transactions on Software Engineering, SE-7(5):472–482, Sept. 1981.
[24]
W. mei W. Hwu and P. P. Chang. Inline function expansion for compiling c programs. In Proceedings of the ACM SIGPLAN 1989 conference on Programming language design and implementation, pages 246–257. ACM, 1989.
[25]
M. Peccoud, M. Griffiths, and M. Peltier. Incremental interactive compilation. In A. Morrell, editor, Information Processing 68, Proceedings of IFIP Congress 1968, Volume 1 Mathematics, Software, pages 384–387. North-Holland, 1969.
[26]
M. Pool. distcc, a fast free distributed compiler. In Proceedings of linux.conf.au 2004, Adelaide, Australia, 2004.
[27]
S. P. Reiss. Generation of compiler symbol processing mechanisms from specifications. ACM Transactions on Programming Languages and Systems (TOPLAS), 5(2):127– 163, April 1983.
[28]
S. P. Reiss. An approach to incremental compilation. In Proceedings of the ACM SIGPLAN ’84, Symposium on Compiler Construction, volume 19 of ACM SIGPLAN Notices, pages 144–156. ACM, June 1984.
[29]
S. P. Reiss. Graphical program development with pecan program development system. In Proceedings of the ACM SIGSOFT/SIGPLAN Software Engineering Symposium on Practical Software Development Environments, volume 19 of ACM SIGPLAN Notices, pages 30–42. ACM, May 1984.
[30]
W. J. Rishel. Incremental compilers. Datamation, 16(1): 129–136, January 1970.
[31]
B. Ryder. A survey of interprocedural data flow analysis techniques. Technical Report DCS-TR-85, Department of Computer Science, Rutgers, The State University of New Jersey, New Brunswick, New Jersey, 1979.
[32]
P. Sathyanathan. Interprocedural Dataflow Analysis – Alias Analysis. PhD thesis, Computer Science Department, Stanford University, Stanford, CA, 2001.
[33]
M. D. Schwartz, N. M. Delisle, and V. S. Begwani. Incremental compilation in magpie. In Proceedings of the ACM SIGPLAN ’84 Symposium on Compiler Construction, volume 19 of ACM SIGPLAN Notices, pages 122–131. ACM, June 1984.
[34]
T. Teitelbaum and T. Reps. The cornell program synthesizer: A syntax-directed programming environment. Communications of the ACM, 24(9):563–573, Sept 1981.
[35]
W. F. Tichy. Smart recompilation. ACM Transactions on Programming Languages and Systems (TOPLAS), 8(3):273– 291, July 1986.
[36]
O. Yigit. String hash functions, 2001.

Cited By

View all
  1. Incremental whole program optimization and compilation

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    CGO '17: Proceedings of the 2017 International Symposium on Code Generation and Optimization
    February 2017
    317 pages
    ISBN:9781509049318

    Sponsors

    Publisher

    IEEE Press

    Publication History

    Published: 04 February 2017

    Check for updates

    Author Tags

    1. Code Generation
    2. Compilers
    3. Incremental Compilers
    4. Optimization

    Qualifiers

    • Article

    Conference

    CGO '17
    Sponsor:

    Acceptance Rates

    CGO '17 Paper Acceptance Rate 26 of 116 submissions, 22%;
    Overall Acceptance Rate 312 of 1,061 submissions, 29%

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)20
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 27 Dec 2024

    Other Metrics

    Citations

    Cited By

    View all

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media