Introduction
This paper introduces the Interprocedural Distributive Environment (IDE) framework, a powerful method for performing highly precise dataflow analysis across procedure boundaries in polynomial time. By representing program transformations as compact graphs, the authors provide a way to solve complex problems like linear constant propagation—even in recursive programs—where previous methods were either imprecise or prone to infinite loops.
The Challenge of Interprocedural Analysis
In static analysis, "interprocedural" analysis (looking across different functions or procedures) is notoriously difficult. A major challenge is ensuring precision: the analysis should only consider "valid paths" that respect the call-return structure of a program. For instance, a function should return to the specific site that called it, not just any call site.
Existing techniques often struggled with two primary issues:
- Recursion: Many algorithms (like the well-known Rice algorithm) become imprecise or fail to terminate when functions call themselves.
- Complex Dataflow Facts: While simple "is this variable a constant?" checks were common, more complex relationships—like "is $x = 5y + 17$?"—were much harder to track efficiently across the whole program.
The IDE Framework Methodology
The authors propose a multi-step approach to transform dataflow analysis into a graph problem. The core of the IDE framework is the Exploded Supergraph, which decomposes environment transformations into "micro-functions."
Key Components:
- Pointwise Representation: Instead of treating an entire environment transformation as one giant "macro-function," they break it down into micro-functions. These represent how a single variable at one program point affects a single variable at the next.
- The Exploded Supergraph: They construct a massive graph where each node is a pair:
(program_point, symbol). Edges between these nodes are labeled with the micro-functions mentioned above. - Two-Phase Dynamic Programming:
- Phase I computes "summary functions" for procedures, essentially pre-calculating what a function does to variables so it doesn't have to be re-analyzed from scratch at every call site.
- Phase II propagates actual data values (like the integer 7) through the graph to find the final constants.
Key Insights and Results
One of the primary "aha" moments is that distributive environment transformers are "compressible." You can represent the composition of many complex transformations as a single, bounded-size graph. This keeps the complexity polynomial ($O(ED^3)$).
The authors evaluated their implementation using five C programs from the SPEC integer benchmark suite (Cint92), including compress, gcc.cpp, and li.
- Higher Precision: In 4 out of 5 benchmarks, the IDE algorithm discovered more constants than a "naive" interprocedural algorithm. For example, in
compress, it found 82 constants compared to the naive version's 50. - Efficiency: Despite the theoretical complexity, the algorithm processed several hundred lines of code per second. The IDE version of copy constant propagation was significantly more memory-efficient than previous "subset-based" frameworks (IFDS).
- Correctness in Recursion: Unlike previous state-of-the-art algorithms, this method remains precise even in the presence of recursive procedure calls.
Limitations and Future Work
The algorithm is guaranteed to terminate only if the value lattice has no infinite decreasing chains. While this covers most practical constant propagation, it doesn't cover every possible IDE problem. Additionally, the experimental implementation handled pointers "conservatively." The authors acknowledge that integrating a more precise pointer analysis would improve results. Subsequent work has also explored "demand-driven" versions of this exhaustive approach.
Summary updated