LLVM-DIFF(1)
π LLVM-DIFF β bestie edition π
okay so this is llvm-diff, from the LLVM manual pages, and it's literally the structural 'diff' tool for LLVM. sit with me, we're gonna go through it together π«Ά
β¨ NAME β¨
llvm-diff β LLVM structural 'diff'. that's it, that's the name, she's simple and she serves π
πΈ SYNOPSIS πΈ
llvm-diff [options] module 1 module 2 [global name β¦]
two modules, and optionally a lil list of global names if you're feeling picky. yes the spaces in module 1 are real, that's how it's written, don't come for me π
π¦ DESCRIPTION π¦
so llvm-diff compares the structure of two LLVM modules. like, it's mostly obsessed with differences in function definitions. the stuff it does NOT care about? insignificant differences β think changes in the ordering of globals, or the names of local values. she said "not my business, not my problem" π
here's the vibe check on how it reads your files:
- if an input module's name ends in
.ll, she'll interpret it as an assembly file. - otherwise? she reads it in as a bitcode file.
and if you hand her a list of global names? then she only compares the values with those names, periodt. but if you don't give her a list, she compares all global values and will produce diagnostics for any globals that only show up in one module or the other. no hiding, bestie π
now, how does she compare two functions? she compares their basic blocks, starting from the entry blocks. if the terminators seem to match, then the corresponding successors get compared. if they don't match? she just ignores them. lowkey brutal.
β οΈ real talk: this algorithm is very sensitive to changes in control flow, and control-flow changes tend to stop any downstream changes from being detected. so like, one shift and the rest goes quiet. iykyk π
and like, who is she for? llvm-diff is intended as a debugging tool for writers of LLVM passes and frontends. she is NOT here to be your stable output format β she doesn't have one. fr fr. π
β EXIT STATUS β
- if
llvm-difffinds no differences between the modules: exits with0and produces no output. silent queen, nothing to say β¨ - otherwise: exits with a non-zero value.
π BUGS π
ngl there are some things she just doesn't catch:
- many important differences are not diagnosed β like changes in linkage or function attributes. she's simply not looking π
- changes in memory behavior (for example, coalescing loads) can cause massive detected differences in blocks. one tiny thing and suddenly everything is "different" and you're just sitting there like π
π AUTHOR π
Maintained by the LLVM Team (https://llvm.org/). icons, honestly π
π COPYRIGHT π
2003-2024, LLVM Project
okay that's the whole page, you're officially caught up, go compare some modules bestie π§π
this was LLVM-DIFF(1) from LLVM, version 15, dated 2024-04-14 β mwah, take care of her, she's iconic π β¨
π¦ where this page comes from
- ubuntu noble: llvm-16 1:16.0.6-23ubuntu4 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms