[llvm] [Passes] Add IR-only SQLite IR tracker (PR #191852)

Yaxun Liu via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 20:48:42 PDT 2026


yxsamliu wrote:

> how helpful is `-exec-on-ir-change` here?

I think `-exec-on-ir-change` is the closest existing hook, and I tried it a bit for this. It can be useful for ad hoc debugging: with a custom callback on a small `.ll` example with real debug locations, I was able to recover the IR tied to one source line by re-parsing each changed snapshot and matching the debug locations. So it does seem possible to build a proof of concept that way.

The part that still worries me is cost. On the same medium llvm-opt-benchmark module from the other timing note, the baseline run was about 4.0 s, `-ir-tracker-database` was about 4.7 s, and `-print-changed` was about 146 s. On that same input, `-exec-on-ir-change=/bin/true` was already in the same ballpark at about 136 s, and once the callback did real work to scan each changed snapshot for one target function, the run went up to about 677 s. That callback was invoked more than ten thousand times, and only a tiny fraction of those snapshots were actually relevant to the function I was looking for. So my current impression is that `-exec-on-ir-change` is helpful as a debugging hook, but not a very good fit for the indexed query workflow here unless we are willing to pay something much closer to the print-based cost model.


https://github.com/llvm/llvm-project/pull/191852


More information about the llvm-commits mailing list