LLVM-DIFF(1)
π LLVM-DIFF(1) β the LLVM page, bestie edition π
okay so this is llvm-diff from the LLVM manual, and I'm gonna explain it like we're texting at 1am. it's a structural diff for LLVM. yes. that kind of diff. let's go π¦
β¨ NAME β¨
llvm-diff β LLVM structural 'diff', no cap π
β¨ SYNOPSIS β¨
llvm-diff [options] module 1 module 2 [global name ...]
πΈ DESCRIPTION πΈ
so llvm-diff compares the structure of two LLVM modules, and it's lowkey obsessed with differences in function definitions. the insignificant stuff? changes in the ordering of globals, changes in the names of local values? ignored. not even a vibe check. π«Ά
here's how it reads your files: an input module gets interpreted as an assembly file if its name ends in .ll β otherwise it's read in as a bitcode file. that's the whole rule, periodt.
now, if you hand it a list of global names, it just compares the values with those names. if you don't? it compares all global values, and it will produce diagnostics for globals that only show up in one module or the other. main character energy of it to call them out, honestly π
when it compares two functions, it does it 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 ignored. ngl this algorithm is very sensitive to changes in control flow β like, one little control-flow change and any downstream changes just... stop being detected. π the downstream stuff never gets its moment.
little heads-up: llvm-diff is intended as a debugging tool for writers of LLVM passes and frontends. it does not have a stable output format. do not build your whole pipeline on parsing its output, bestie, I'm begging π
π₯ EXIT STATUS π₯
- if
llvm-difffinds no differences between the modules, it exits with0and produces no output. silence. iconic. β - otherwise it exits with a non-zero value. something's different and it will let you know π
π BUGS π
- many important differences are not diagnosed β like changes in linkage or function attributes. yeah. those. π¬
- changes in memory behavior (for example, coalescing loads) can cause massive detected differences in blocks. like, disproportionate. dramatic even. π
π AUTHOR π
Maintained by the LLVM Team (https://llvm.org/). π«Ά
π COPYRIGHT π
2003-2026, LLVM Project
and that's the whole page, bestie β 23, dated 2026-10-06, straight from the LLVM-DIFF(1) manual. go diff something structural and slay β¨ππ§
π¦ where this page comes from
- centos-stream 9: llvm 23.1.3-1.el9 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- centos-stream 9: llvm 23.1.3-1.el9 Β· Apache-2.0 WITH LLVM-exception OR NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms