Scalable and Precise Static Analysis for Large-Scale Software Systems
Abstract
Static program analysis is a cornerstone of modern software engineering, supporting bug detection, ensuring security checks, and enabling compiler optimizations that improve both performance and maintainability of programs. By identifying issues in programs early, static analyzers help development teams reduce debugging effort and maintenance cost. However, deploying static analyzers within software development teams faces two main challenges: choosing an optimal set of analyzers and balancing the tradeoff between precision and scalability. To make static analyzers impactful, developers must first determine the optimal combination of tools that best aligns with the specific goals and constraints of their project. At the same time, the selected analyzers must deliver precise results while maintaining scalability on large codebases that exceed hundreds of thousands of lines of code. This thesis addresses these challenges by working on two fronts. First, we present a static analyzer selection framework that recommends an optimal set of analyzers based on project specific requirements. Users can specify each analyzer’s ability to detect different bug types and adjust parameters of the framework to prioritize the detection of certain bugs. They can also express constraints on resource usage according to their resource limit, enabling a balanced trade-off between resource usage and analysis performance. Second, we design a suite of precise and scalable pointer analysis algorithms to enhance the quality of downstream analyses while maintaining scalability on large codebases. Pointer analysis is a foundational step in most static analysis pipelines, providing analyzers a better understanding of program memory behavior. To improve the efficiency of flow-sensitive pointer analysis, we propose Level-based Intermediate variable Skipping Pointer Analysis (LisPA), a new approach that removes redundant computations and unnecessary propagation of points-to sets for intermediate variables introduced during the Static Single Assignment (SSA) transformation. The key insight behind LisPA is that intermediate variables do not introduce new pointers into the analysis and always alias with variables in the original programs. To further enhance scalability, we developed GPA, a Graphics Processing Unit (GPU)-based implementation of flow-sensitive pointer analysis that leverages the massive parallelism of modern graphics hardware. By combining parallel execution with a Graph Neural Network (GNN) that predicts per-variable workloads, GPA significantly reduces the analysis time, enabling the analysis of very large programs in hours rather than days. We evaluate the three aforementioned components of this work on a large industry codebase and a diverse set of real-world benchmarks with size ranging from 1 KLOC to over 1 MLOC to understand their impacts on static analyzers. Our evaluation begins with the analyzer selection framework, which consistently outperforms several natural baseline strategies, leading to the detection of more bugs in a case study we conduct on a large Oracle codebase. With the better analyzer selection framework, we evaluate how the latter two components improve flow-sensitive pointer analysis. LisPA achieves an average speedup of 2.14x while reducing the memory consumption by 2.38x compared to the baseline. To explore scalability limitations, we evaluate the GPU-based implementation, GPA, which delivers 1.3x to 14x speedup on large programs (i.e., ≥275 KLOC) without sacrificing precision. On smaller (i.e., <100 KLOC) and medium-sized (i.e., 100–275 KLOC) programs, however, traditional algorithms on either single-thread CPUs or multi-thread CPUs run faster due to the overhead from GPU memory management. Together, these results demonstrate that combining analyzer selection framework, algorithmic optimizations, and hardware acceleration for flow-sensitive pointer analysis, static analysis can be both precise and scalable for large-scale software systems.