APG improves automatic code repair using LLVM program analysis graphs
APG: Agentic Static-Analysis Infrastructure on LLVM-IR Graph Databases
Software Engineering
Summary
Fixing bugs in computer programs often requires understanding complicated program details. The authors created APG, a tool that breaks down program analysis into simple pieces that smart code agents can pick and combine to investigate problems more effectively. This approach helps the agents ask better questions and find better answers when fixing bugs, leading to more successful repairs and less wasted effort. APG was tested on many C and C++ bugs and fixed more problems than existing tools while needing less input from large language models.
What this means in practice
- •For software developers: Improve automated bug fixing in C and C++ projects by enabling coding agents to better analyze program structures and errors using APG's atomic analysis functions.
- •For software maintenance teams: Reduce effort and resource use when repairing code defects by relying on APG’s efficient static-analysis orchestration to guide debugging processes.
Authors
Zexin Zhong, Yanjun Zhang, Yulei Sui, Xiao Cheng
Abstract
LLM-based coding agents increasingly rely on external program knowledge, yet access to static-analysis graphs alone does not ensure appropriate operation selection or evidence interpretation. We present APG, an infrastructure for semantics-grounded static program analysis. Built on SVF and LLVM, it decomposes compiler-derived program analyses into atomic capabilities that LLM agents can select, compose, and orchestrate for goal-directed, cross-graph investigation, with query safeguards and evidence traces preserving inspectable results and provenance. APG provides 38 atomic capabilities. On analysis requests arising during benchmark repair runs, 35 achieve first-attempt query-generation success rates above 50%, including 13 at 100%. Evaluation on 812 C/C++ defects shows higher repair success than the evaluated baselines. Compared with Passive Graph Push, APG improves first-iteration repair success by 17.6 and 18.0 percentage points on the two benchmark collections and reduces average LLM input-token consumption by 90.8%. Our tool is available at https://github.com/JasonZhongZexin/APG-ICSE-Demo and its demonstration video at https://youtu.be/vkuExZUjGnw