1BUGPOINT(1) LLVM BUGPOINT(1)
2
3
4
6 bugpoint - automatic test case reduction tool
7
9 bugpoint [options] [input LLVM ll/bc files] [LLVM passes] --args pro‐
10 gram arguments
11
13 bugpoint narrows down the source of problems in LLVM tools and passes.
14 It can be used to debug three types of failures: optimizer crashes,
15 miscompilations by optimizers, or bad native code generation (including
16 problems in the static and JIT compilers). It aims to reduce large
17 test cases to small, useful ones. For more information on the design
18 and inner workings of bugpoint, as well as advice for using bugpoint,
19 see /Bugpoint in the LLVM distribution.
20
22 --additional-so library
23 Load the dynamic shared object library into the test program when‐
24 ever it is run. This is useful if you are debugging programs which
25 depend on non-LLVM libraries (such as the X or curses libraries) to
26 run.
27
28 --append-exit-code={true,false}
29 Append the test programs exit code to the output file so that a
30 change in exit code is considered a test failure. Defaults to false.
31
32 --args program args
33 Pass all arguments specified after --args to the test program when‐
34 ever it runs. Note that if any of the program args start with a
35 "-", you should use:
36
37 bugpoint [bugpoint args] --args -- [program args]
38
39 The "--" right after the --args option tells bugpoint to consider
40 any options starting with "-" to be part of the --args option, not
41 as options to bugpoint itself.
42
43 --tool-args tool args
44 Pass all arguments specified after --tool-args to the LLVM tool un‐
45 der test (llc, lli, etc.) whenever it runs. You should use this op‐
46 tion in the following way:
47
48 bugpoint [bugpoint args] --tool-args -- [tool args]
49
50 The "--" right after the --tool-args option tells bugpoint to con‐
51 sider any options starting with "-" to be part of the --tool-args
52 option, not as options to bugpoint itself. (See --args, above.)
53
54 --safe-tool-args tool args
55 Pass all arguments specified after --safe-tool-args to the "safe"
56 execution tool.
57
58 --gcc-tool-args gcc tool args
59 Pass all arguments specified after --gcc-tool-args to the invocation
60 of gcc.
61
62 --opt-args opt args
63 Pass all arguments specified after --opt-args to the invocation of
64 opt.
65
66 --disable-{dce,simplifycfg}
67 Do not run the specified passes to clean up and reduce the size of
68 the test program. By default, bugpoint uses these passes internally
69 when attempting to reduce test programs. If you're trying to find a
70 bug in one of these passes, bugpoint may crash.
71
72 --enable-valgrind
73 Use valgrind to find faults in the optimization phase. This will al‐
74 low bugpoint to find otherwise asymptomatic problems caused by mem‐
75 ory mis-management.
76
77 -find-bugs
78 Continually randomize the specified passes and run them on the test
79 program until a bug is found or the user kills bugpoint.
80
81 -help
82 Print a summary of command line options.
83
84 --input filename
85 Open filename and redirect the standard input of the test program,
86 whenever it runs, to come from that file.
87
88 --load plugin
89 Load the dynamic object plugin into bugpoint itself. This object
90 should register new optimization passes. Once loaded, the object
91 will add new command line options to enable various optimizations.
92 To see the new complete list of optimizations, use the -help and
93 --load options together; for example:
94
95 bugpoint --load myNewPass.so -help
96
97 --mlimit megabytes
98 Specifies an upper limit on memory usage of the optimization and
99 codegen. Set to zero to disable the limit.
100
101 --output filename
102 Whenever the test program produces output on its standard output
103 stream, it should match the contents of filename (the "reference
104 output"). If you do not use this option, bugpoint will attempt to
105 generate a reference output by compiling the program with the "safe"
106 backend and running it.
107
108 --run-{int,jit,llc,custom}
109 Whenever the test program is compiled, bugpoint should generate code
110 for it using the specified code generator. These options allow you
111 to choose the interpreter, the JIT compiler, the static native code
112 compiler, or a custom command (see --exec-command) respectively.
113
114 --safe-{llc,custom}
115 When debugging a code generator, bugpoint should use the specified
116 code generator as the "safe" code generator. This is a known-good
117 code generator used to generate the "reference output" if it has not
118 been provided, and to compile portions of the program that as they
119 are excluded from the testcase. These options allow you to choose
120 the static native code compiler, or a custom command, (see
121 --exec-command) respectively. The interpreter and the JIT backends
122 cannot currently be used as the "safe" backends.
123
124 --exec-command command
125 This option defines the command to use with the --run-custom and
126 --safe-custom options to execute the bitcode testcase. This can be
127 useful for cross-compilation.
128
129 --compile-command command
130 This option defines the command to use with the --compile-custom op‐
131 tion to compile the bitcode testcase. The command should exit with a
132 failure exit code if the file is "interesting" and should exit with
133 a success exit code (i.e. 0) otherwise (this is the same as if it
134 crashed on "interesting" inputs).
135
136 This can be useful for testing compiler output without running any
137 link or execute stages. To generate a reduced unit test, you may add
138 CHECK directives to the testcase and pass the name of an executable
139 compile-command script in this form:
140
141 #!/bin/sh
142 llc "$@"
143 not FileCheck [bugpoint input file].ll < bugpoint-test-program.s
144
145 This script will "fail" as long as FileCheck passes. So the result
146 will be the minimum bitcode that passes FileCheck.
147
148 --safe-path path
149 This option defines the path to the command to execute with the
150 --safe-{int,jit,llc,custom} option.
151
152 --verbose-errors={true,false}
153 The default behavior of bugpoint is to print "<crash>" when it finds
154 a reduced test that crashes compilation. This flag prints the output
155 of the crashing program to stderr. This is useful to make sure it is
156 the same error being tracked down and not a different error that
157 happens to crash the compiler as well. Defaults to false.
158
160 If bugpoint succeeds in finding a problem, it will exit with 0. Other‐
161 wise, if an error occurs, it will exit with a non-zero value.
162
164 opt(1)
165
167 Maintained by the LLVM Team (https://llvm.org/).
168
170 2003-2022, LLVM Project
171
172
173
174
17514 2022-03-23 BUGPOINT(1)