arXiv:2611.02349cs.SENov 2026

Manuscript Offprint

arXiv:2611.02349

APG: Agentic Static-Analysis Infrastructure on LLVM-IR Graph Databases

Zexin Zhong, Yanjun Zhang, Yulei Sui, Xiao Cheng

Zexin Zhong

University of Technology Sydney

Sydney, Australia

zexin.zhong@student.uts.edu.au

Yanjun Zhang

Griffith University

Queensland, Australia

yanjun.zhang@griffith.edu.au

Yulei Sui

University of New South Wales

Sydney, Australia

y.sui@unsw.edu.au

Xiao Cheng

Macquarie University

Sydney, Australia

xiao.cheng@mq.edu.au

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.

I. INTRODUCTION

Interprocedural static analysis on LLVM IR, as realized by frameworks such as SVF [1], computes precise structural facts about system-level C/C++ programs, including pointer aliasing, value-flow dependencies, and control-flow reachability across compilation units. Such structural evidence can inform fault localization [2] and program repair [3], yet providing agents with usable access to these analyses remains a challenge. RLCE retrieves repository context for repair [4]; STALL+ integrates static analysis into code completion [5]; and RepoGraph provides graph-based repository navigation [6]. These systems focus on repository context, code completion, and navigation. Exposing LLVM-IR interprocedural analyses as reusable, agent-invocable capabilities poses a further infrastructure challenge.

These facts should instead be supplied to agents directly, letting the model focus on higher-level reasoning such as defect interpretation, root-cause localization, and fix synthesis. A graph database is a natural vehicle: many program analyses reduce to graph reachability [7], and a declarative language such as Cypher lets an agent express what structural information it needs without encoding how to traverse the analyzer's internal data structures, a separation far more amenable to LLM interaction than imperative analysis APIs.

However, merely connecting an LLM to a static-analysis database does not make it capable of using static analysis correctly. Program-analysis graphs encode specialized relationships whose meanings depend on their underlying analysis semantics. An agent must determine which analysis operation is appropriate, how to express its intended goal, and what conclusions the returned evidence supports. A schema-valid query may still investigate the wrong relationship, while an empty result does not necessarily establish the absence of a program property.

This gap motivates two design principles. First, program-analysis infrastructure should be agent-facing: designed for LLM agents as primary consumers, exposing semantically meaningful analysis capabilities rather than only low-level graph operations. Second, it should be inspectable: agent-generated operations should be checked against supported constraints, and the evidence underlying analysis conclusions should remain traceable.

We present APG, an infrastructure for semantics-grounded static program analysis. Built on SVF and LLVM, APG decomposes compiler-derived program analyses into atomic, agent-invocable capabilities through a semantics-aware interface. LLM agents select and orchestrate these capabilities for goal-directed, iterative investigation of program structures, while query safeguards and provenance-aware evidence organization support constrained and inspectable program investigation.

The main tool contributions are:

  • LLVM-IR graph database infrastructure. APG materializes five SVF-derived interprocedural analysis graphs (PAG, ICFG, Call Graph, SVFBasicBlock Graph, and CHG) into a queryable graph database, making compiler-precise program relationships accessible via declarative Cypher queries.

  • Agent-facing analysis interaction and orchestration. APG decomposes static analyses into atomic capabilities that LLM agents select and orchestrate through a semantics-aware interface, enabling goal-directed, iterative investigation of program structures.

  • Inspectable, evidence-grounded investigation. APG integrates query safeguards and provenance-aware evidence organization to make analysis operations and their supporting structural evidence inspectable.

II. TOOL DESIGN AND IMPLEMENTATION

Fig. 1 illustrates the architecture of APG. Building on SVF [1], the framework materializes five compiler-derived program-analysis graphs (PAG, ICFG, Call Graph, SVFBasicBlock Graph, and CHG) in TuGraph [8] for on-demand structural queries.

Given a defect description or analysis question, the agent formulates analysis goals and selects semantic capabilities through a semantics-aware interface. An iterative controller coordinates query assessment, execution, and follow-up investigation. Retrieved results are consolidated into local and global evidence summaries, while analysis traces preserve the operations, queries, and execution feedback for inspection. The accumulated evidence supports fault diagnosis and downstream automated repair.

The architecture realizes two principles: agent-facing interaction, which exposes static-analysis operations as agent-invocable semantic capabilities, and inspectable investigation, which constrains operations and retains traceable evidence. The following subsections describe the three mechanisms.