LLVM-DIFF(1)

πŸ“¦
version 11.1.0 Β· 2 versions
, in fedora 43, fedora 44

✨ LLVM-DIFF πŸ’…

okay bestie, so this is llvm-diff, and it lives in the LLVM manual (section 1, the "user commands" section, iykyk). she's a structural 'diff' for LLVM and honestly? iconic. πŸ¦‹


🌸 SYNOPSIS 🌸

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

like. that's it. that's the whole thing. two modules, some options, maybe some names. slay.


πŸ‘‘ DESCRIPTION πŸ‘‘

so what does she actually DO? llvm-diff compares the structure of two LLVM modules, and her main character energy is all about differences in function definitions. πŸ”₯

the little stuff? the insignificant stuff? not her problem. changes in the ordering of globals or in the names of local values get ignored, no cap. she's not here to nitpick your variable naming, she's here for the ~structure~.

now, how does she read your files? listen up:

  • if an input module's name ends in .ll, it gets interpreted as an assembly file.
  • otherwise? it's read in as a bitcode file.

periodt. that's the vibe check. πŸŽ€

and about that list of global names:

  • if you give her a list of global names, then just the values with those names get compared.
  • if you don't, then all global values get compared β€” and she'll produce diagnostics for globals that only show up in one module or the other. πŸ’€

now for the real tea, the algorithm itself. llvm-diff compares two functions by comparing their basic blocks, starting from the entry blocks. then:

  • if the terminators seem to match, the corresponding successors get compared.
  • if they don't match, those successors are just… ignored. πŸ™ˆ

and here's the thing you NEED to know: this algorithm is very sensitive to changes in control flow. like, extremely. changes in control flow tend to stop any downstream changes from being detected. so if your control flow moved around, don't be surprised when the rest goes quiet. it's giving "can't see past the drama." 😭

last thing β€” and this is important β€” llvm-diff is intended as a debugging tool for writers of LLVM passes and frontends. she is NOT for production pipelines, bestie. and she does not have a stable output format. so don't you dare parse her output and expect it to be the same next version. fr fr.


⭐ EXIT STATUS ⭐

  • if llvm-diff finds no differences between the modules, she exits with 0 and produces no output. peaceful. serene. πŸ•ŠοΈ
  • otherwise, she exits with a non-zero value. πŸ’…

πŸ’€ BUGS πŸ’€

okay so she's not perfect and she knows it. listen:

  • many important differences are not diagnosed β€” like changes in linkage or function attributes. yeah. she just… doesn't check those. 😭
  • changes in memory behavior (for example, coalescing loads) can cause massive detected differences in blocks. so a tiny memory tweak can make it look like the whole world ended. dramatic, but that's the algorithm for you.

🫢 AUTHOR 🫢

maintained by the LLVM Team (https://llvm.org/). give them their flowers. 🌸


2003-2024, LLVM Project


and that's the whole page, bestie!! πŸŽ€βœ¨ this was the LLVM-DIFF(1) page from the LLVM manual, version dated 2024-07-18, page 11. go diff something structural and think of me. bye!! πŸ’…πŸ¦‹

πŸ“¦ where this page comes from