LLVM-DIFF(1)

πŸ’… NAME πŸ’…

llvm-diff β€” the LLVM structural 'diff', aka the glow-up detector for your modules ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

llvm-diff [options] module 1 module 2 [global name …]

🌸 DESCRIPTION 🌸

okay so bestie, picture this: llvm-diff compares the structure of two LLVM modules, and it's lowkey obsessed with differences in function definitions above all else. The stuff that doesn't actually matter β€” like the order your globals are chillin' in, or what the local values decided to name themselves β€” gets ignored, no cap. πŸ’β€β™€οΈ

An input module gets read as an assembly file if its name ends in .ll; otherwise it gets read in as a bitcode file. That's the vibe check, fr fr.

If you hand it a list of global names, then it only compares the values with those names β€” just those ones, nothing else. But if you don't, it compares all the global values, and it will produce diagnostics for globals that only show up in one module or the other. not me snitching on your missing globals 😭

Here's the way it compares two functions: it goes block by block through their basic blocks, starting with the entry blocks, main character energy. If the terminators seem to match, then it compares the corresponding successors; otherwise it just ignores them. 🫢 Heads up though β€” this algorithm is very sensitive to changes in control flow, and those changes tend to stop any downstream changes from being detected. so one little control-flow edit and the rest of your diff is just... silent. it's giving "ghosted". πŸ’€

llvm-diff is intended as a debugging tool for writers of LLVM passes and frontends. And for real: it does not have a stable output format. So don't go parsing it in a script, babe. πŸŽ€


⭐ EXIT STATUS ⭐

If llvm-diff finds no differences between the modules, it will exit with 0 and produce no output. literally silence, the good kind 🀫 Otherwise it will exit with a non-zero value. slay, it found something.


πŸ’€ BUGS πŸ’€

  • Many important differences, like changes in linkage or function attributes, are not diagnosed. yeah. it simply doesn't look. πŸ™ˆ
  • Changes in memory behavior (for example, coalescing loads) can cause massive detected differences in blocks. so it'll scream at you about stuff that's lowkey fine. iconic behavior honestly.

πŸ‘‘ AUTHOR πŸ‘‘

Maintained by the LLVM Team (https://llvm.org/). πŸ’–


2003-2025, LLVM Project


and that's the whole page, bestie πŸŽ€ this was LLVM-DIFF(1) from the LLVM manual, version 14, dated 2025-05-22 β€” go forth and diff structurally, you absolute legend πŸ’…βœ¨

πŸ“¦ where this page comes from