X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=docs%2FHowToSubmitABug.html;h=90efbe321b1429e1fc77cf081eef70430b1f0eee;hb=136e4912806a2182a41e3011e86830a9c77160f0;hp=77bf040a9900fb200b83fdd724b6526e316e2e6e;hpb=97510e7894f98a27c109b8426a4ccf413ce810db;p=oota-llvm.git diff --git a/docs/HowToSubmitABug.html b/docs/HowToSubmitABug.html index 77bf040a990..90efbe321b1 100644 --- a/docs/HowToSubmitABug.html +++ b/docs/HowToSubmitABug.html @@ -19,9 +19,8 @@
Basically you have to do two things at a minimum. First, decide whether the bug crashes the compiler (or an LLVM pass), or if the -compiler is miscompiling the program. Based on +compiler is miscompiling the program (i.e., the +compiler successfully produces an executable, but it doesn't run right). Based +on what type of bug it is, follow the instructions in the linked section to narrow down the bug so that the person who fixes it will be able to find the problem more easily.
Once you have a reduced test-case, go to the LLVM Bug Tracking -System, select the category in which the bug falls, and fill out the form -with the necessary details. The bug description should contain the following +href="http://llvm.org/bugs/enter_bug.cgi">the LLVM Bug Tracking +System and fill out the form with the necessary details (note that you don't +need to pick a category, just use the "new-bugs" category if you're not sure). +The bug description should contain the following information:
More often than not, bugs in the compiler cause it to crash - often due to an -assertion failure of some sort. If you are running opt or -analyze directly, and something crashes, jump to the section on -bugs in LLVM passes. Otherwise, the most important -piece of the puzzle is to figure out if it is the GCC-based front-end that is -buggy or if it's one of the LLVM tools that has problems.
+More often than not, bugs in the compiler cause it to crash—often due +to an assertion failure of some sort. The most important +piece of the puzzle is to figure out if it is crashing in the GCC front-end +or if it is one of the LLVM libraries (e.g. the optimizer or code generator) +that has problems.
-To figure out which program is crashing (the front-end, -gccas, or gccld), run the +
To figure out which component is crashing (the front-end, +optimizer or code generator), run the llvm-gcc command line as you were when the crash occurred, but -add a -v option to the command line. The compiler will print out a -bunch of stuff, and should end with telling you that one of -cc1/cc1plus, gccas, or -gccld crashed.
+with the following extra command line options:The delta tool helps to reduce the +preprocessed file down to the smallest amount of code that still replicates the +problem. You're encouraged to use delta to reduce the code to make the +developers' lives easier. This website +has instructions on the best way to use delta.
If you find that a bug crashes in the gccas stage of -compilation, compile your test-case to a .s file with the --save-temps option to llvm-gcc. Then run:
+If you find that a bug crashes in the optimizer, compile your test-case to a +.bc file by passing "-emit-llvm -O0 -c -o foo.bc". +Then run:
gccas -debug-pass=Arguments < /dev/null -o - > /dev/null
-... which will print a list of arguments, indicating the list of passes that -gccas runs. Once you have the input file and the list of -passes, go to the section on debugging bugs in LLVM -passes.
- +opt -std-compile-opts -debug-pass=Arguments foo.bc + -disable-output
This command should do two things: it should print out a list of passes, and +then it should crash in the same was as llvm-gcc. If it doesn't crash, please +follow the instructions for a front-end bug.
-If you find that a bug crashes in the gccld stage of -compilation, gather all of the .o bytecode files and libraries that are -being linked together (the "llvm-gcc -v" output should include -the full list of objects linked). Then run:
+If this does crash, then you should be able to debug this with the following +bugpoint command:
llvm-as < /dev/null > null.bc
-gccld -debug-pass=Arguments null.bc
-
bugpoint foo.bc <list of passes printed by +opt>
... which will print a list of arguments, indicating the list of passes that -gccld runs. Once you have the input files and the list of -passes, go to the section on debugging bugs in LLVM -passes.
+Please run this, then file a bug with the instructions and reduced .bc files +that bugpoint emits. If something goes wrong with bugpoint, please submit the +"foo.bc" file and the list of passes printed by opt.
At this point, you should have some number of LLVM assembly files or bytecode -files and a list of passes which crash when run on the specified input. In -order to reduce the list of passes (which is probably large) and the input to -something tractable, use the bugpoint tool as follows:
+If you find a bug that crashes llvm-gcc in the code generator, compile your +source file to a .bc file by passing "-emit-llvm -c -o foo.bc" +to llvm-gcc (in addition to the options you already pass). Once your have +foo.bc, one of the following commands should fail:
-bugpoint <input files> <list of passes>
-bugpoint will print a bunch of output as it reduces the -test-case, but it should eventually print something like this:
+If none of these crash, please follow the instructions for a +front-end bug. If one of these do crash, you should +be able to reduce this with one of the following bugpoint command lines (use +the one corresponding to the command above that failed):
-
-...
-Emitted bytecode to 'bugpoint-reduced-simplified.bc'
-
-*** You can reproduce the problem with: opt bugpoint-reduced-simplified.bc -licm
-
Once you complete this, please send the LLVM bytecode file and the command -line to reproduce the problem to the llvmbugs mailing list.
+Please run this, then file a bug with the instructions and reduced .bc file +that bugpoint emits. If something goes wrong with bugpoint, please submit the +"foo.bc" file and the option that llc crashes with.
A miscompilation occurs when a pass does not correctly transform a program, -thus producing errors that are only noticed during execution. This is different -from producing invalid LLVM code (i.e., code not in SSA form, using values -before defining them, etc.) which the verifier will check for after a pass -finishes its run.
- -If it looks like the LLVM compiler is miscompiling a program, the very first -thing to check is to make sure it is not using undefined behavior. In -particular, check to see if the program valgrinds clean, passes purify, or some -other memory checker tool. Many of the "LLVM bugs" that we have chased down -ended up being bugs in the program being compiled, not LLVM.
+If llvm-gcc successfully produces an executable, but that executable doesn't +run right, this is either a bug in the code or a bug in the +compiler. The first thing to check is to make sure it is not using undefined +behavior (e.g. reading a variable before it is defined). In particular, check +to see if the program valgrinds clean, +passes purify, or some other memory checker tool. Many of the "LLVM bugs" that +we have chased down ended up being bugs in the program being compiled, not + LLVM.
Once you determine that the program itself is not buggy, you should choose which code generator you wish to compile the program with (e.g. C backend, the @@ -243,7 +234,7 @@ JIT, or LLC) and optionally a series of LLVM passes to run. For example:
bugpoint will try to narrow down your list of passes to the one pass -that causes an error, and simplify the bytecode file as much as it can to assist +that causes an error, and simplify the bitcode file as much as it can to assist you. It will print a message letting you know how to reproduce the resulting error.
@@ -269,8 +260,8 @@ Backend, and then link in the shared object it generates.-bugpoint -run-jit -output=[correct output file] [bytecode file] \ - --tool-args -- [arguments to pass to lli] \ +bugpoint -run-jit -output=[correct output file] [bitcode file] \ + --tool-args -- [arguments to pass to lli] \ --args -- [program arguments]
-bugpoint -run-llc -output=[correct output file] [bytecode file] \ - --tool-args -- [arguments to pass to llc] \ +bugpoint -run-llc -output=[correct output file] [bitcode file] \ + --tool-args -- [arguments to pass to llc] \ --args -- [program arguments]
At the end of a successful bugpoint run, you will be presented -with two bytecode files: a safe file which can be compiled with the C +with two bitcode files: a safe file which can be compiled with the C backend and the test file which either LLC or the JIT mis-codegenerates, and thus causes the error.
@@ -307,7 +298,7 @@ the following:Regenerate the shared object from the safe bytecode file:
+Regenerate the shared object from the safe bitcode file:
@@ -316,19 +307,19 @@ the following:
If debugging LLC, compile test bytecode native and link with the shared +
If debugging LLC, compile test bitcode native and link with the shared object:
-llc test.bc -o test.s -f
+llc test.bc -o test.s
gcc test.s safe.so -o test.llc
./test.llc [program options]
If debugging the JIT, load the shared object and supply the test - bytecode:
+ bitcode:lli -load=safe.so test.bc [program options]
@@ -342,12 +333,12 @@ the following: