We have developed a hybrid algorithm for interprocedural constant propagation combining two prior methods with a new demand-driven approach. We modified a prior intraprocedural constant propagator to use incrementally in a demand-driven interprocedural framework. We compare our algorithm to three prior interprocedural methods. Burke and Cytron solve the interprocedural constant propagation problem with an algorithm that uses a pessimistic incremental intraprocedural constant propagator to iterate forward and backward over the call graph until no new information is discovered. Wegman and Zadeck solve the intraprocedural constant propagation problem with an optimistic algorithm. Their algorithm solves the sparse conditional constant problem. The interprocedural version of their algorithm links the Static Single Assignment graphs of all procedures together and runs their intraprocedural algorithm over the single SSA graph. Grove and Torczon performed experiments that show Jump Functions combined with procedure summary blocks as described by Callahan et. alare effective at finding interprocedural constants. We show that our interprocedural algorithm, Demand-driven With Incremental Modification (DWIM), is fast and finds the same number of constants as the best interprocedural constant propagator in use today. We know of no implementations of either interprocedural Wegman-Zadeck or Burke-Cytron algorithms. Over a set of standard benchmarks we find 46.4\% more interprocedural constants compared to intraprocedural constants.
Recommendations
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 ...
Flow-sensitive interprocedural constant propagation
PLDI '95: Proceedings of the ACM SIGPLAN 1995 conference on Programming language design and implementationWe present a flow-sensitive interprocedural constant propagation algorithm, which supports recursion while only performing one flow-sensitive analysis of each procedure. We present experimental results which show that this method finds substantially ...
Flow-sensitive interprocedural constant propagation
We present a flow-sensitive interprocedural constant propagation algorithm, which supports recursion while only performing one flow-sensitive analysis of each procedure. We present experimental results which show that this method finds substantially ...