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