LLVM-DIFF(1)

πŸ’… LLVM-DIFF(1) β€” the LLVM structural 'diff', bestie edition

okay so this is llvm-diff, from the LLVM manual set. it's giving "structural diff but make it compiler nerd" and honestly? iconic. let's get into it πŸ¦‹


✨ NAME ✨

llvm-diff β€” LLVM structural 'diff'. that's it, that's the name, no cap πŸ’–


🌸 SYNOPSIS 🌸

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

like. two modules. and optionally some global names. slay.


πŸŽ€ DESCRIPTION πŸŽ€

okay so llvm-diff compares the structure of two LLVM modules, and it's mostly obsessed with the differences in function definitions. the stuff it does not care about β€” the insignificant little differences, like changes in the ordering of globals or changes in the names of local values β€” it literally ignores them. vibe check: passed, moving on πŸ’…

here's the tea on how it reads your files: an input module gets interpreted as an assembly file if its name ends in .ll. otherwise? it gets read in as a bitcode file. no in-between, that's the rule, periodt.

if you hand it a list of global names, then it only compares the values with those names. if you don't? then all global values get compared, and it produces diagnostics for globals which only appear in one module or the other. so like, it will absolutely call out the globals that showed up alone to the party πŸ™ˆ

now, how does it compare two functions? by comparing their basic blocks, starting with the entry blocks. if the terminators seem to match, then the corresponding successors get compared; otherwise they are ignored. and bestie, listen β€” this algorithm is very sensitive to changes in control flow. like, extremely. changes in control flow tend to stop any downstream changes from being detected at all. it's giving "one domino falls and the whole trail goes quiet" 😭

llvm-diff is intended as a debugging tool for writers of LLVM passes and frontends. and it does not have a stable output format. so don't you dare parse it and expect it to behave, iykyk πŸ‘‘


⭐ EXIT STATUS ⭐

if llvm-diff finds no differences between the modules, it will exit with 0 and produce no output. silence. peace. zen 🧘

otherwise it will exit with a non-zero value. so if you see numbers, something's different fr fr.


πŸ’€ BUGS πŸ’€

many important differences, like changes in linkage or function attributes, are not diagnosed. yeah. it just won't tell you. tragic.

changes in memory behavior (for example, coalescing loads) can cause massive detected differences in blocks. so you might get a wall of diffs that's technically downstream of one tiny memory thing. it's giving overreaction but make it a compiler πŸ”₯


πŸ‘‘ Author πŸ‘‘

maintained by the LLVM Team (https://llvm.org/). the real ones 🫢


2003-2026, LLVM Project


and that's the whole page, bestie β€” LLVM-DIFF(1) from the LLVM manual, page 22, dated 2026-07-16. go forth and diff structurally, mwah πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from