]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/clang/bugpoint/bugpoint.1
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / usr.bin / clang / bugpoint / bugpoint.1
1 .\" $FreeBSD$
2 .\" Man page generated from reStructuredText.
3 .
4 .TH "BUGPOINT" "1" "2020-06-26" "10" "LLVM"
5 .SH NAME
6 bugpoint \- automatic test case reduction tool
7 .
8 .nr rst2man-indent-level 0
9 .
10 .de1 rstReportMargin
11 \\$1 \\n[an-margin]
12 level \\n[rst2man-indent-level]
13 level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
14 -
15 \\n[rst2man-indent0]
16 \\n[rst2man-indent1]
17 \\n[rst2man-indent2]
18 ..
19 .de1 INDENT
20 .\" .rstReportMargin pre:
21 . RS \\$1
22 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin]
23 . nr rst2man-indent-level +1
24 .\" .rstReportMargin post:
25 ..
26 .de UNINDENT
27 . RE
28 .\" indent \\n[an-margin]
29 .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]]
30 .nr rst2man-indent-level -1
31 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
32 .in \\n[rst2man-indent\\n[rst2man-indent-level]]u
33 ..
34 .SH SYNOPSIS
35 .sp
36 \fBbugpoint\fP [\fIoptions\fP] [\fIinput LLVM ll/bc files\fP] [\fILLVM passes\fP] \fB\-\-args\fP
37 \fIprogram arguments\fP
38 .SH DESCRIPTION
39 .sp
40 \fBbugpoint\fP narrows down the source of problems in LLVM tools and passes.  It
41 can be used to debug three types of failures: optimizer crashes, miscompilations
42 by optimizers, or bad native code generation (including problems in the static
43 and JIT compilers).  It aims to reduce large test cases to small, useful ones.
44 For more information on the design and inner workings of \fBbugpoint\fP, as well as
45 advice for using bugpoint, see /Bugpoint in the LLVM
46 distribution.
47 .SH OPTIONS
48 .sp
49 \fB\-\-additional\-so\fP \fIlibrary\fP
50 .INDENT 0.0
51 .INDENT 3.5
52 Load the dynamic shared object \fIlibrary\fP into the test program whenever it is
53 run.  This is useful if you are debugging programs which depend on non\-LLVM
54 libraries (such as the X or curses libraries) to run.
55 .UNINDENT
56 .UNINDENT
57 .sp
58 \fB\-\-append\-exit\-code\fP=\fI{true,false}\fP
59 .INDENT 0.0
60 .INDENT 3.5
61 Append the test programs exit code to the output file so that a change in exit
62 code is considered a test failure. Defaults to false.
63 .UNINDENT
64 .UNINDENT
65 .sp
66 \fB\-\-args\fP \fIprogram args\fP
67 .INDENT 0.0
68 .INDENT 3.5
69 Pass all arguments specified after \fB\-\-args\fP to the test program whenever it runs.
70 Note that if any of the \fIprogram args\fP start with a "\fB\-\fP", you should use:
71 .INDENT 0.0
72 .INDENT 3.5
73 .sp
74 .nf
75 .ft C
76 bugpoint [bugpoint args] \-\-args \-\- [program args]
77 .ft P
78 .fi
79 .UNINDENT
80 .UNINDENT
81 .sp
82 The "\fB\-\-\fP" right after the \fB\-\-args\fP option tells \fBbugpoint\fP to consider
83 any options starting with "\fB\-\fP" to be part of the \fB\-\-args\fP option, not as
84 options to \fBbugpoint\fP itself.
85 .UNINDENT
86 .UNINDENT
87 .sp
88 \fB\-\-tool\-args\fP \fItool args\fP
89 .INDENT 0.0
90 .INDENT 3.5
91 Pass all arguments specified after \fB\-\-tool\-args\fP to the LLVM tool under test
92 (\fBllc\fP, \fBlli\fP, etc.) whenever it runs.  You should use this option in the
93 following way:
94 .INDENT 0.0
95 .INDENT 3.5
96 .sp
97 .nf
98 .ft C
99 bugpoint [bugpoint args] \-\-tool\-args \-\- [tool args]
100 .ft P
101 .fi
102 .UNINDENT
103 .UNINDENT
104 .sp
105 The "\fB\-\-\fP" right after the \fB\-\-tool\-args\fP option tells \fBbugpoint\fP to
106 consider any options starting with "\fB\-\fP" to be part of the \fB\-\-tool\-args\fP
107 option, not as options to \fBbugpoint\fP itself. (See \fB\-\-args\fP, above.)
108 .UNINDENT
109 .UNINDENT
110 .sp
111 \fB\-\-safe\-tool\-args\fP \fItool args\fP
112 .INDENT 0.0
113 .INDENT 3.5
114 Pass all arguments specified after \fB\-\-safe\-tool\-args\fP to the "safe" execution
115 tool.
116 .UNINDENT
117 .UNINDENT
118 .sp
119 \fB\-\-gcc\-tool\-args\fP \fIgcc tool args\fP
120 .INDENT 0.0
121 .INDENT 3.5
122 Pass all arguments specified after \fB\-\-gcc\-tool\-args\fP to the invocation of
123 \fBgcc\fP\&.
124 .UNINDENT
125 .UNINDENT
126 .sp
127 \fB\-\-opt\-args\fP \fIopt args\fP
128 .INDENT 0.0
129 .INDENT 3.5
130 Pass all arguments specified after \fB\-\-opt\-args\fP to the invocation of \fBopt\fP\&.
131 .UNINDENT
132 .UNINDENT
133 .sp
134 \fB\-\-disable\-{dce,simplifycfg}\fP
135 .INDENT 0.0
136 .INDENT 3.5
137 Do not run the specified passes to clean up and reduce the size of the test
138 program. By default, \fBbugpoint\fP uses these passes internally when attempting to
139 reduce test programs.  If you\(aqre trying to find a bug in one of these passes,
140 \fBbugpoint\fP may crash.
141 .UNINDENT
142 .UNINDENT
143 .sp
144 \fB\-\-enable\-valgrind\fP
145 .INDENT 0.0
146 .INDENT 3.5
147 Use valgrind to find faults in the optimization phase. This will allow
148 bugpoint to find otherwise asymptomatic problems caused by memory
149 mis\-management.
150 .UNINDENT
151 .UNINDENT
152 .sp
153 \fB\-find\-bugs\fP
154 .INDENT 0.0
155 .INDENT 3.5
156 Continually randomize the specified passes and run them on the test program
157 until a bug is found or the user kills \fBbugpoint\fP\&.
158 .UNINDENT
159 .UNINDENT
160 .sp
161 \fB\-help\fP
162 .INDENT 0.0
163 .INDENT 3.5
164 Print a summary of command line options.
165 .UNINDENT
166 .UNINDENT
167 .sp
168 \fB\-\-input\fP \fIfilename\fP
169 .INDENT 0.0
170 .INDENT 3.5
171 Open \fIfilename\fP and redirect the standard input of the test program, whenever
172 it runs, to come from that file.
173 .UNINDENT
174 .UNINDENT
175 .sp
176 \fB\-\-load\fP \fIplugin\fP
177 .INDENT 0.0
178 .INDENT 3.5
179 Load the dynamic object \fIplugin\fP into \fBbugpoint\fP itself.  This object should
180 register new optimization passes.  Once loaded, the object will add new command
181 line options to enable various optimizations.  To see the new complete list of
182 optimizations, use the \fB\-help\fP and \fB\-\-load\fP options together; for example:
183 .INDENT 0.0
184 .INDENT 3.5
185 .sp
186 .nf
187 .ft C
188 bugpoint \-\-load myNewPass.so \-help
189 .ft P
190 .fi
191 .UNINDENT
192 .UNINDENT
193 .UNINDENT
194 .UNINDENT
195 .sp
196 \fB\-\-mlimit\fP \fImegabytes\fP
197 .INDENT 0.0
198 .INDENT 3.5
199 Specifies an upper limit on memory usage of the optimization and codegen. Set
200 to zero to disable the limit.
201 .UNINDENT
202 .UNINDENT
203 .sp
204 \fB\-\-output\fP \fIfilename\fP
205 .INDENT 0.0
206 .INDENT 3.5
207 Whenever the test program produces output on its standard output stream, it
208 should match the contents of \fIfilename\fP (the "reference output"). If you
209 do not use this option, \fBbugpoint\fP will attempt to generate a reference output
210 by compiling the program with the "safe" backend and running it.
211 .UNINDENT
212 .UNINDENT
213 .sp
214 \fB\-\-run\-{int,jit,llc,custom}\fP
215 .INDENT 0.0
216 .INDENT 3.5
217 Whenever the test program is compiled, \fBbugpoint\fP should generate code for it
218 using the specified code generator.  These options allow you to choose the
219 interpreter, the JIT compiler, the static native code compiler, or a
220 custom command (see \fB\-\-exec\-command\fP) respectively.
221 .UNINDENT
222 .UNINDENT
223 .sp
224 \fB\-\-safe\-{llc,custom}\fP
225 .INDENT 0.0
226 .INDENT 3.5
227 When debugging a code generator, \fBbugpoint\fP should use the specified code
228 generator as the "safe" code generator. This is a known\-good code generator
229 used to generate the "reference output" if it has not been provided, and to
230 compile portions of the program that as they are excluded from the testcase.
231 These options allow you to choose the
232 static native code compiler, or a custom command, (see \fB\-\-exec\-command\fP)
233 respectively. The interpreter and the JIT backends cannot currently
234 be used as the "safe" backends.
235 .UNINDENT
236 .UNINDENT
237 .sp
238 \fB\-\-exec\-command\fP \fIcommand\fP
239 .INDENT 0.0
240 .INDENT 3.5
241 This option defines the command to use with the \fB\-\-run\-custom\fP and
242 \fB\-\-safe\-custom\fP options to execute the bitcode testcase. This can
243 be useful for cross\-compilation.
244 .UNINDENT
245 .UNINDENT
246 .sp
247 \fB\-\-compile\-command\fP \fIcommand\fP
248 .INDENT 0.0
249 .INDENT 3.5
250 This option defines the command to use with the \fB\-\-compile\-custom\fP
251 option to compile the bitcode testcase. The command should exit with a
252 failure exit code if the file is "interesting" and should exit with a
253 success exit code (i.e. 0) otherwise (this is the same as if it crashed on
254 "interesting" inputs).
255 .sp
256 This can be useful for
257 testing compiler output without running any link or execute stages. To
258 generate a reduced unit test, you may add CHECK directives to the
259 testcase and pass the name of an executable compile\-command script in this form:
260 .INDENT 0.0
261 .INDENT 3.5
262 .sp
263 .nf
264 .ft C
265 #!/bin/sh
266 llc "$@"
267 not FileCheck [bugpoint input file].ll < bugpoint\-test\-program.s
268 .ft P
269 .fi
270 .UNINDENT
271 .UNINDENT
272 .sp
273 This script will "fail" as long as FileCheck passes. So the result
274 will be the minimum bitcode that passes FileCheck.
275 .UNINDENT
276 .UNINDENT
277 .sp
278 \fB\-\-safe\-path\fP \fIpath\fP
279 .INDENT 0.0
280 .INDENT 3.5
281 This option defines the path to the command to execute with the
282 \fB\-\-safe\-{int,jit,llc,custom}\fP
283 option.
284 .UNINDENT
285 .UNINDENT
286 .sp
287 \fB\-\-verbose\-errors\fP=\fI{true,false}\fP
288 .INDENT 0.0
289 .INDENT 3.5
290 The default behavior of bugpoint is to print "<crash>" when it finds a reduced
291 test that crashes compilation. This flag prints the output of the crashing
292 program to stderr. This is useful to make sure it is the same error being
293 tracked down and not a different error that happens to crash the compiler as
294 well. Defaults to false.
295 .UNINDENT
296 .UNINDENT
297 .SH EXIT STATUS
298 .sp
299 If \fBbugpoint\fP succeeds in finding a problem, it will exit with 0.  Otherwise,
300 if an error occurs, it will exit with a non\-zero value.
301 .SH SEE ALSO
302 .sp
303 \fBopt(1)\fP
304 .SH AUTHOR
305 Maintained by the LLVM Team (https://llvm.org/).
306 .SH COPYRIGHT
307 2003-2020, LLVM Project
308 .\" Generated by docutils manpage writer.
309 .