xref: /openbsd-src/gnu/llvm/llvm/docs/CommandGuide/llvm-diff.rst (revision 09467b48e8bc8b4905716062da846024139afbf2)
1*09467b48Spatrickllvm-diff - LLVM structural 'diff'
2*09467b48Spatrick==================================
3*09467b48Spatrick
4*09467b48Spatrick.. program:: llvm-diff
5*09467b48Spatrick
6*09467b48SpatrickSYNOPSIS
7*09467b48Spatrick--------
8*09467b48Spatrick
9*09467b48Spatrick**llvm-diff** [*options*] *module 1* *module 2* [*global name ...*]
10*09467b48Spatrick
11*09467b48SpatrickDESCRIPTION
12*09467b48Spatrick-----------
13*09467b48Spatrick
14*09467b48Spatrick**llvm-diff** compares the structure of two LLVM modules, primarily
15*09467b48Spatrickfocusing on differences in function definitions.  Insignificant
16*09467b48Spatrickdifferences, such as changes in the ordering of globals or in the
17*09467b48Spatricknames of local values, are ignored.
18*09467b48Spatrick
19*09467b48SpatrickAn input module will be interpreted as an assembly file if its name
20*09467b48Spatrickends in '.ll';  otherwise it will be read in as a bitcode file.
21*09467b48Spatrick
22*09467b48SpatrickIf a list of global names is given, just the values with those names
23*09467b48Spatrickare compared; otherwise, all global values are compared, and
24*09467b48Spatrickdiagnostics are produced for globals which only appear in one module
25*09467b48Spatrickor the other.
26*09467b48Spatrick
27*09467b48Spatrick**llvm-diff** compares two functions by comparing their basic blocks,
28*09467b48Spatrickbeginning with the entry blocks.  If the terminators seem to match,
29*09467b48Spatrickthen the corresponding successors are compared; otherwise they are
30*09467b48Spatrickignored.  This algorithm is very sensitive to changes in control flow,
31*09467b48Spatrickwhich tend to stop any downstream changes from being detected.
32*09467b48Spatrick
33*09467b48Spatrick**llvm-diff** is intended as a debugging tool for writers of LLVM
34*09467b48Spatrickpasses and frontends.  It does not have a stable output format.
35*09467b48Spatrick
36*09467b48SpatrickEXIT STATUS
37*09467b48Spatrick-----------
38*09467b48Spatrick
39*09467b48SpatrickIf **llvm-diff** finds no differences between the modules, it will exit
40*09467b48Spatrickwith 0 and produce no output.  Otherwise it will exit with a non-zero
41*09467b48Spatrickvalue.
42*09467b48Spatrick
43*09467b48SpatrickBUGS
44*09467b48Spatrick----
45*09467b48Spatrick
46*09467b48SpatrickMany important differences, like changes in linkage or function
47*09467b48Spatrickattributes, are not diagnosed.
48*09467b48Spatrick
49*09467b48SpatrickChanges in memory behavior (for example, coalescing loads) can cause
50*09467b48Spatrickmassive detected differences in blocks.
51