LLVM-DIFF(1)

πŸ’… LLVM-DIFF(1) πŸ’…

ok so bestie, you're reading the llvm-diff page from the LLVM manual set, and honestly? it's giving "structural diff but make it a whole personality." let's get into it 🫢


✨ NAME ✨

llvm-diff β€” the LLVM structural 'diff', aka the vibe check for your modules πŸ’–


🌸 SYNOPSIS 🌸

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

like, you feed it two modules and maybe some global names. that's the whole thing. slay.


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so llvm-diff compares the structure of two LLVM modules, and it's lowkey hyperfixated on differences in function definitions. the stuff it does NOT care about? insignificant differences β€” like if your globals got reordered, or if your local values got renamed. it literally ignores those. it's not like other diff tools πŸ’…

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 cap, that's the rule. ✨

if you pass a list of global names, then guess what β€” just the values with those names get compared. but if you don't pass any? then all global values get compared, and it produces diagnostics for globals that only show up in one module or the other. messy but honest 😭

now for the actual comparison algorithm, because this part is kind of iconic: llvm-diff compares 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're just ignored. and here's the catch, bestie β€” this algorithm is very sensitive to changes in control flow. like, one little control-flow change and it can stop any downstream changes from being detected. downstream erasure, fr fr πŸ’€

so who is this even for? 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 please don't build your whole pipeline on parsing its output, i'm begging πŸ™ˆ


πŸ‘‘ EXIT STATUS πŸ‘‘

  • if llvm-diff finds no differences between the modules, it will exit with 0 and produce no output. silent queen behavior 🌈
  • otherwise it will exit with a non-zero value. πŸ”₯

πŸ’€ BUGS πŸ’€

real talk, there are some gaps:

  • many important differences, like changes in linkage or function attributes, are not diagnosed. yeah. it just doesn't. πŸ™ˆ
  • changes in memory behavior (for example, coalescing loads) can cause massive detected differences in blocks. so if the diff looks unhinged, it might just be memory stuff, not a real bug. 😭

πŸŽ€ Author πŸŽ€

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


2003-2026, LLVM Project β€” all the rights, all the vibes. πŸ¦‹


alright bestie, that's the whole page β€” LLVM-DIFF(1) from the LLVM manual, page 15, dated 2026-09-09, wrapped up with love from the LLVM Project πŸ§šπŸ’œ go diff some modules and stay iconic ✨

πŸ“¦ where this page comes from