LLVM-DIFF(1)
π llvm-diff β the LLVM structural 'diff' π
okay bestie, so this is llvm-diff from the LLVM manual, page LLVM-DIFF(1). it's a whole vibe and it's genuinely iconic. let's get into it π«Ά
β¨ SYNOPSIS β¨
llvm-diff [options] module 1 module 2 [global name ...]
literally that's it. two modules, some options, maybe some global names if you're feeling spicy πΈ
π¦ DESCRIPTION π¦
so llvm-diff compares the structure of two LLVM modules, and it's mostly obsessed with differences in function definitions. that's the main character of this whole operation.
the good news? insignificant differences are ignored, no cap. stuff like:
- changes in the ordering of globals
- changes in the names of local values
those? don't matter. not even a little. we move on π
now, how does it read your input module? it depends on the name, bestie:
- if the name ends in
.ll, the input module gets interpreted as an assembly file - otherwise, it gets read in as a bitcode file
no .ll? no assembly. it's giving bitcode. that's just the rules β¨
and here's where the globals come in: if you hand it a list of global names, then just the values with those names get compared. otherwise, all global values are compared, and diagnostics get produced for globals which only appear in one module or the other. so yeah, it will snitch on the ones that ghosted one side π
how does it compare two functions tho? by comparing their basic blocks, beginning with the entry blocks. then:
- if the terminators seem to match β the corresponding successors get compared
- otherwise β they're ignored, bye βοΈ
and okay, lowkey a warning: this algorithm is very sensitive to changes in control flow, and those tend to stop any downstream changes from being detected. so likeβ¦ one tiny control flow change and everything after it just goes quiet. it's giving "one domino fell and now nobody's talking" π
also important, fr fr: llvm-diff is intended as a debugging tool for writers of LLVM passes and frontends. it does not have a stable output format. so don't go building your whole CI pipeline on its exact output, bestie, that's not the assignment π
π EXIT STATUS π
- if
llvm-difffinds no differences between the modules β exits with0and produces no output. silent. peaceful. slay. β¨ - otherwise β exits with a non-zero value π¨
π BUGS π
okay so there are some known issues and we're gonna be honest about them:
- many important differences, like changes in linkage or function attributes, are not diagnosed. so yeah. it might just not notice. not me finding out the hard way π
- changes in memory behavior (for example, coalescing loads) can cause massive detected differences in blocks. like, disproportionate. dramatic. it's giving chaos π
π AUTHOR π
Maintained by the LLVM Team (https://llvm.org/). they're the parents of this whole thing, we love them π«Ά
π§ COPYRIGHT π§
2003-2024, LLVM Project
and that's the whole page bestie!! π this was the LLVM manual, version 12, dated 2024-07-18, page LLVM-DIFF(1) β go forth and diff your modules, i'm obsessed with you, mwah ππβ¨
π¦ where this page comes from
- fedora 43: llvm12 12.0.1-12.fc41 Β· NCSA
- fedora 43: llvm12 12.0.1-12.fc41 Β· NCSA
- fedora 44: llvm12 12.0.1-12.fc41 Β· NCSA
- fedora 44: llvm12 12.0.1-12.fc41 Β· NCSA
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms