Constant propagation is a well-known global flow analysis problem. The goal of constant propagation is to discover values that are constant on all possible executions of a program and to propagate these constant values as far forward through the program as possible. Expressions whose operands are all constants can be evaluated at compile time and the results propagated further. Using the algorithms in this paper can produce smaller and faster compiled programs. The same algorithms can be used for other kinds of analyses (e.g. type determination). We present four algorithms in this paper, all {\it conservative} in the sense that all constants may not be found, but each constant found is constant over all possible executions of the program. These algorithms are among the simplest, fastest, and most powerful global constant propagation algorithms known. A new algorithm is also presented that performs a form of interprocedural data flow analysis in which aliasing information is gathered in conjunction with constant propagation. Several variants of this algorithm are considered.
Cited By
- Chase D, Wegman M and Zadeck F (2004). Analysis of pointers and structures, ACM SIGPLAN Notices, 39:4, (343-359), Online publication date: 1-Apr-2004.
- Weise D, Crew R, Ernst M and Steensgaard B Value dependence graphs Proceedings of the 21st ACM SIGPLAN-SIGACT symposium on Principles of programming languages, (297-310)
- Venkatesh G and Fischer C (2019). SPARE, IEEE Transactions on Software Engineering, 18:4, (304-318), Online publication date: 1-Apr-1992.
- MacLachlan R The Python compiler for CMU Common Lisp Proceedings of the 1992 ACM conference on LISP and functional programming, (235-246)
- MacLachlan R (1992). The Python compiler for CMU Common Lisp, ACM SIGPLAN Lisp Pointers, V:1, (235-246), Online publication date: 1-Jan-1992.
- Kennedy K, McKinley K and Tseng C (2019). Interactive Parallel Programming using the ParaScope Editor, IEEE Transactions on Parallel and Distributed Systems, 2:3, (329-341), Online publication date: 1-Jul-1991.
- Kennedy K, McKinley K and Tseng C Analysis and transformation in the ParaScope editor Proceedings of the 5th international conference on Supercomputing, (433-447)
- Chase D, Wegman M and Zadeck F Analysis of pointers and structures Proceedings of the ACM SIGPLAN 1990 conference on Programming language design and implementation, (296-310)
- Chase D, Wegman M and Zadeck F (1990). Analysis of pointers and structures, ACM SIGPLAN Notices, 25:6, (296-310), Online publication date: 1-Jun-1990.
- Venkatesh G A framework for construction and evaluation of high-level specifications for program analysis techniques Proceedings of the ACM SIGPLAN 1989 conference on Programming language design and implementation, (1-12)
- Venkatesh G (1989). A framework for construction and evaluation of high-level specifications for program analysis techniques, ACM SIGPLAN Notices, 24:7, (1-12), Online publication date: 1-Jul-1989.
- Cytron R, Ferrante J, Rosen B, Wegman M and Zadeck F An efficient method of computing static single assignment form Proceedings of the 16th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, (25-35)
Recommendations
Constant propagation with conditional branches
Constant propagation is a well-known global flow analysis problem. The goal of constant propagation is to discover values that are constant on all possible executions of a program and to propagate these constant values as far foward through the program ...
Interprocedural constant propagation: an empirical study
Constant propagation is an optimization that substitutes values for names. Interprocedural constant propagation performs this substitution throughout an entire program, propagating constant values across procedure boundaries. CONVEX Computer Corporation ...