LLVM-DIFF(1)

πŸ’… LLVM-DIFF(1)

okay so real talk, bestie β€” this is llvm-diff, and it ships with LLVM. it's literally a structural diff for LLVM modules and it's lowkey iconic for anyone who writes passes. let's get into it 🫢


✨ SYNOPSIS ✨

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

like, two modules, and optionally a lil list of names. that's the whole vibe. πŸŽ€


🌸 DESCRIPTION 🌸

llvm-diff compares the structure of two LLVM modules β€” and its main character energy is all about differences in function definitions. the way it works: insignificant stuff, like globals being in a different order or local values having different names? yeah, it simply does not care. ignored. not the vibe check. πŸ’€

An input module gets interpreted as an assembly file if its name ends in '.ll' β€” otherwise it's read in as a bitcode file. no cap, that's the whole rule. πŸ“

If you hand it a list of global names, then just the values with those names get compared. otherwise? every global value gets compared, and you get diagnostics for globals that only show up in one module and not the other. πŸ‘€

When it compares two functions, it compares their basic blocks, starting from the entry blocks. if the terminators seem to match, then the corresponding successors get compared too; if they don't match, those successors are just ignored. heads up though β€” this algorithm is very sensitive to changes in control flow, and those changes tend to stop any downstream changes from ever being detected. so like… fr fr, one control-flow tweak and everything after it goes quiet. 😭

llvm-diff is intended as a debugging tool for writers of LLVM passes and frontends. and plot twist: it does not have a stable output format. so don't go parsing it, bestie, that's not the move. πŸ™ˆ


πŸ”₯ EXIT STATUS πŸ”₯

If llvm-diff finds no differences between the modules, it exits with 0 and produces no output β€” silent, slaying, nothing to say. ✨

Otherwise it exits with a non-zero value. πŸ’…


πŸ’€ BUGS πŸ’€

Many important differences are not diagnosed β€” like changes in linkage or function attributes. yeah. those just slip right past. πŸ™ƒ

Also, changes in memory behavior (for example, coalescing loads) can cause massive detected differences in blocks. so a tiny memory-level change can show up looking like a whole glow-up went wrong. πŸ“


πŸ‘‘ Author πŸ‘‘

Maintained by the LLVM Team (https://llvm.org/). periodt. 🧚


2003-2026, LLVM Project πŸ’œ


okay that's the whole page!! this one's from the LLVM fam, dated 2026-10-20, page 23 of your manual, and the title is, of course, LLVM-DIFF(1) β€” go forth and diff structurally, bestie 🌈⭐

πŸ“¦ where this page comes from
  • arch rolling: llvm 23.1.4-1 Β· Apache-2.0 WITH LLVM-exception
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms