LLVM-DIFF(1)

πŸ’… LLVM-DIFF β€” the manual, but make it make sense

okay so bestie, welcome to llvm-diff from the LLVM manual, section 1 ✨ this is the page for the LLVM structural 'diff' tool and honestly it's giving detective energy πŸ”


✨ NAME ✨

llvm-diff β€” LLVM structural 'diff' πŸ¦‹


✨ SYNOPSIS ✨

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

✨ DESCRIPTION ✨

so what does it even do πŸ‘€ llvm-diff compares the structure of two LLVM modules, and it's mostly obsessed with differences in function definitions. the whole point is that insignificant differences β€” like the order globals show up in, or the names of local values β€” get straight up ignored. not the vibe, not the tea, we don't care πŸ’…

here's the lore on how your input gets read: an input module is interpreted as an assembly file if its name ends in .ll; otherwise it gets read in as a bitcode file. that's it, that's the whole rule πŸ”₯

if you hand it a list of global names, then only the values with those names get compared. no list? then all global values get compared, and you'll get diagnostics for any globals that only show up in one module or the other. main character energy from the globals fr fr πŸ‘‘

and now, how it compares two functions: it compares their basic blocks, starting with the entry blocks. if the terminators seem to match, then the corresponding successors get compared; if they don't seem to match, those successors just get ignored, no cap. heads up though β€”

this algorithm is very sensitive to changes in control flow, which tend to stop any downstream changes from being detected 😭 like one little branch change and the rest of the diff just goes quiet on you

one more thing: llvm-diff is intended as a debugging tool for writers of LLVM passes and frontends. it does not have a stable output format, so please don't parse it, bestie, i'm begging πŸ™ˆ


✨ EXIT STATUS ✨

  • if llvm-diff finds no differences between the modules, it exits with 0 and produces no output 🌸
  • otherwise it exits with a non-zero value πŸ’€

✨ BUGS ✨

okay so the flaws, we're being honest 🫢

  • many important differences are not diagnosed, like changes in linkage or function attributes. yeah. iconic of it, unfortunately.
  • changes in memory behavior (for example, coalescing loads) can cause massive detected differences in blocks. like, unhinged amounts. brace yourself 😭

✨ AUTHOR ✨

maintained by the LLVM Team (https://llvm.org/) πŸ‘‘


2003-2026, LLVM Project πŸŽ€


okay that's the whole page, bestie, you're basically a diff expert now ⭐

LLVM-DIFF(1) Β· page 21 Β· dated 2026-07-22 Β· brought to you by the LLVM manual, section 1 πŸ¦‹βœ¨ periodt πŸ’–

πŸ“¦ where this page comes from