Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
| 3 | <html> |
| 4 | <head> |
| 5 | <title>How to submit an LLVM bug report</title> |
| 6 | <link rel="stylesheet" href="llvm.css" type="text/css"> |
| 7 | </head> |
| 8 | <body> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 9 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 10 | <div class="doc_title"> |
| 11 | How to submit an LLVM bug report |
| 12 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 13 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 14 | <table border="0" width="100%"> |
| 15 | <tr> |
| 16 | <td valign="top"> |
| 17 | |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 18 | <ol> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 19 | <li><a href="#introduction">Introduction - Got bugs?</a></li> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 20 | <li><a href="#crashers">Crashing Bugs</a> |
| 21 | <ul> |
| 22 | <li><a href="#front-end">Front-end bugs</a> |
| 23 | <li><a href="#gccas">GCCAS bugs</a> |
| 24 | <li><a href="#gccld">GCCLD bugs</a> |
| 25 | <li><a href="#passes">Bugs in LLVM passes</a> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 26 | </ul></li> |
| 27 | <li><a href="#miscompilations">Miscompilations</a></li> |
| 28 | <li><a href="#codegen">Incorrect code generation (JIT and LLC)</a></li> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 29 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 30 | </ol> |
| 31 | |
Misha Brukman | 637cab0 | 2004-01-15 19:03:47 +0000 | [diff] [blame] | 32 | <div class="doc_text"> |
| 33 | <p><b>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a> and |
| 34 | <a href="http://misha.brukman.net">Misha Brukman</a></b></p> |
| 35 | </div> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 36 | |
| 37 | </td> |
| 38 | <td align="right"> |
Misha Brukman | 637cab0 | 2004-01-15 19:03:47 +0000 | [diff] [blame] | 39 | <img src="Debugging.gif" alt="Debugging" width="444" height="314"> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 40 | </td> |
| 41 | </tr> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 42 | </table> |
| 43 | |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 44 | <!-- *********************************************************************** --> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 45 | <div class="doc_section"> |
| 46 | <a name="introduction">Introduction - Got bugs?</a> |
| 47 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 48 | <!-- *********************************************************************** --> |
| 49 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 50 | <div class="doc_text"> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 51 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 52 | <p>If you're working with LLVM and run into a bug, we definitely want to know |
| 53 | about it. This document describes what you can do to increase the odds of |
| 54 | getting it fixed quickly.</p> |
| 55 | |
| 56 | <p>Basically you have to do two things at a minimum. First, decide whether the |
| 57 | bug <a href="#crashers">crashes the compiler</a> (or an LLVM pass), or if the |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 58 | compiler is <a href="#miscompilations">miscompiling</a> the program. Based on |
| 59 | what type of bug it is, follow the instructions in the linked section to narrow |
| 60 | down the bug so that the person who fixes it will be able to find the problem |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 61 | more easily.</p> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 62 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 63 | <p>Once you have a reduced test-case, go to <a |
| 64 | href="http://llvm.cs.uiuc.edu/bugs/enter_bug.cgi">the LLVM Bug Tracking |
| 65 | System</a>, select the category in which the bug falls, and fill out the form |
| 66 | with the necessary details. The bug description should contain the following |
| 67 | information:</p> |
| 68 | |
John Criswell | 4d37c7b | 2003-10-22 15:06:11 +0000 | [diff] [blame] | 69 | <ul> |
Misha Brukman | afac73e | 2003-10-22 17:01:44 +0000 | [diff] [blame] | 70 | <li>All information necessary to reproduce the problem.</li> |
| 71 | <li>The reduced test-case that triggers the bug.</li> |
| 72 | <li>The location where you obtained LLVM (if not from our CVS |
| 73 | repository).</li> |
John Criswell | 4d37c7b | 2003-10-22 15:06:11 +0000 | [diff] [blame] | 74 | </ul> |
| 75 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 76 | <p>Thanks for helping us make LLVM better!</p> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 77 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 78 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 79 | |
| 80 | <!-- *********************************************************************** --> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 81 | <div class="doc_section"> |
| 82 | <a name="crashers">Crashing Bugs</a> |
| 83 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 84 | <!-- *********************************************************************** --> |
| 85 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 86 | <div class="doc_text"> |
| 87 | |
| 88 | <p>More often than not, bugs in the compiler cause it to crash - often due to an |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 89 | assertion failure of some sort. If you are running <tt><b>opt</b></tt> or |
| 90 | <tt><b>analyze</b></tt> directly, and something crashes, jump to the section on |
| 91 | <a href="#passes">bugs in LLVM passes</a>. Otherwise, the most important |
| 92 | piece of the puzzle is to figure out if it is the GCC-based front-end that is |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 93 | buggy or if it's one of the LLVM tools that has problems.</p> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 94 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 95 | <p>To figure out which program is crashing (the front-end, |
| 96 | <tt><b>gccas</b></tt>, or <tt><b>gccld</b></tt>), run the |
| 97 | <tt><b>llvm-gcc</b></tt> command line as you were when the crash occurred, but |
| 98 | add a <tt>-v</tt> option to the command line. The compiler will print out a |
John Criswell | 7992691 | 2004-03-12 20:42:16 +0000 | [diff] [blame] | 99 | bunch of stuff, and should end with telling you that one of |
| 100 | <tt><b>cc1</b>/<b>cc1plus</b></tt>, <tt><b>gccas</b></tt>, or |
| 101 | <tt><b>gccld</b></tt> crashed.</p> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 102 | |
| 103 | <ul> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 104 | |
John Criswell | 7992691 | 2004-03-12 20:42:16 +0000 | [diff] [blame] | 105 | <li>If <tt><b>cc1</b></tt> or <tt><b>cc1plus</b></tt> crashed, you found a |
| 106 | problem with the front-end. |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 107 | Jump ahead to the section on <a href="#front-end">front-end bugs</a>.</li> |
| 108 | |
| 109 | <li>If <tt><b>gccas</b></tt> crashed, you found a bug in <a href="#gccas">one |
| 110 | of the passes in <tt><b>gccas</b></tt></a>.</li> |
| 111 | |
| 112 | <li>If <tt><b>gccld</b></tt> crashed, you found a bug in <a href="#gccld">one |
| 113 | of the passes in <tt><b>gccld</b></tt></a>.</li> |
| 114 | |
| 115 | <li>Otherwise, something really weird happened. Email the list with what you |
| 116 | have at this point.</li> |
| 117 | |
| 118 | </ul> |
| 119 | |
| 120 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 121 | |
| 122 | <!-- ======================================================================= --> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 123 | <div class="doc_subsection"> |
| 124 | <a name="front-end">Front-end bugs</a> |
| 125 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 126 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 127 | <div class="doc_text"> |
| 128 | |
| 129 | <p>If the problem is in the front-end, you should re-run the same |
Brian Gaeke | eefe979 | 2003-05-23 21:03:50 +0000 | [diff] [blame] | 130 | <tt>llvm-gcc</tt> command that resulted in the crash, but add the |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 131 | <tt>-save-temps</tt> option. The compiler will crash again, but it will leave |
| 132 | behind a <tt><i>foo</i>.i</tt> file (containing preprocessed C source code) and |
| 133 | possibly <tt><i>foo</i>.s</tt> (containing LLVM assembly code), for each |
| 134 | compiled <tt><i>foo</i>.c</tt> file. Send us the <tt><i>foo</i>.i</tt> file, |
| 135 | along with a brief description of the error it caused.</p> |
| 136 | |
| 137 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 138 | |
| 139 | <!-- ======================================================================= --> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 140 | <div class="doc_subsection"> |
| 141 | <a name="gccas">GCCAS bugs</a> |
| 142 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 143 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 144 | <div class="doc_text"> |
| 145 | |
| 146 | <p>If you find that a bug crashes in the <tt><b>gccas</b></tt> stage of |
Brian Gaeke | eefe979 | 2003-05-23 21:03:50 +0000 | [diff] [blame] | 147 | compilation, compile your test-case to a <tt>.s</tt> file with the |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 148 | <tt>-save-temps</tt> option to <tt><b>llvm-gcc</b></tt>. Then run:</p> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 149 | |
Misha Brukman | f4e4feb | 2004-04-15 20:49:32 +0000 | [diff] [blame^] | 150 | <div class="doc_code"> |
| 151 | <p><tt><b>gccas</b> -debug-pass=Arguments < /dev/null -o - > /dev/null |
| 152 | </tt></p> |
| 153 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 154 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 155 | <p>... which will print a list of arguments, indicating the list of passes that |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 156 | <tt><b>gccas</b></tt> runs. Once you have the input file and the list of |
| 157 | passes, go to the section on <a href="#passes">debugging bugs in LLVM |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 158 | passes</a>.</p> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 159 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 160 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 161 | |
| 162 | <!-- ======================================================================= --> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 163 | <div class="doc_subsection"> |
| 164 | <a name="gccld">GCCLD bugs</a> |
| 165 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 166 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 167 | <div class="doc_text"> |
| 168 | |
| 169 | <p>If you find that a bug crashes in the <tt><b>gccld</b></tt> stage of |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 170 | compilation, gather all of the <tt>.o</tt> bytecode files and libraries that are |
| 171 | being linked together (the "<tt><b>llvm-gcc</b> -v</tt>" output should include |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 172 | the full list of objects linked). Then run:</p> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 173 | |
Misha Brukman | f4e4feb | 2004-04-15 20:49:32 +0000 | [diff] [blame^] | 174 | <div class="doc_code"> |
| 175 | <p><tt><b>llvm-as</b> < /dev/null > null.bc |
| 176 | <b>gccld</b> -debug-pass=Arguments null.bc</tt></p> |
| 177 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 178 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 179 | <p>... which will print a list of arguments, indicating the list of passes that |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 180 | <tt><b>gccld</b></tt> runs. Once you have the input files and the list of |
| 181 | passes, go to the section on <a href="#passes">debugging bugs in LLVM |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 182 | passes</a>.</p> |
| 183 | |
| 184 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 185 | |
| 186 | <!-- ======================================================================= --> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 187 | <div class="doc_subsection"> |
| 188 | <a name="passes">Bugs in LLVM passes</a> |
| 189 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 190 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 191 | <div class="doc_text"> |
| 192 | |
| 193 | <p>At this point, you should have some number of LLVM assembly files or bytecode |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 194 | files and a list of passes which crash when run on the specified input. In |
| 195 | order to reduce the list of passes (which is probably large) and the input to |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 196 | something tractable, use the <tt><b>bugpoint</b></tt> tool as follows:</p> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 197 | |
Misha Brukman | f4e4feb | 2004-04-15 20:49:32 +0000 | [diff] [blame^] | 198 | <div class="doc_code"> |
| 199 | <p><tt><b>bugpoint</b> <input files> <list of passes></tt></p> |
| 200 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 201 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 202 | <p><tt><b>bugpoint</b></tt> will print a bunch of output as it reduces the |
| 203 | test-case, but it should eventually print something like this:</p> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 204 | |
| 205 | <pre> |
| 206 | ... |
| 207 | Emitted bytecode to 'bugpoint-reduced-simplified.bc' |
| 208 | |
| 209 | *** You can reproduce the problem with: opt bugpoint-reduced-simplified.bc -licm |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 210 | </pre> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 211 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 212 | <p>Once you complete this, please send the LLVM bytecode file and the command |
| 213 | line to reproduce the problem to the llvmbugs mailing list.</p> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 214 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 215 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 216 | |
| 217 | <!-- *********************************************************************** --> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 218 | <div class="doc_section"> |
| 219 | <a name="miscompilations">Miscompilations</a> |
| 220 | </div> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 221 | <!-- *********************************************************************** --> |
| 222 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 223 | <div class="doc_text"> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 224 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 225 | <p>A miscompilation occurs when a pass does not correctly transform a program, |
| 226 | thus producing errors that are only noticed during execution. This is different |
| 227 | from producing invalid LLVM code (i.e., code not in SSA form, using values |
| 228 | before defining them, etc.) which the verifier will check for after a pass |
| 229 | finishes its run.</p> |
| 230 | |
| 231 | <p>To debug a miscompilation, you should choose which program you wish to run |
| 232 | the output through, e.g. C backend, the JIT, or LLC, and a selection of passes, |
| 233 | one of which may be causing the error, and run, for example:</p> |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 234 | |
Misha Brukman | f4e4feb | 2004-04-15 20:49:32 +0000 | [diff] [blame^] | 235 | <div class="doc_code"> |
| 236 | <p><tt><b>bugpoint</b> -run-cbe [... optimization passes ...] file-to-test.bc |
| 237 | --args -- [program arguments]</tt></p> |
| 238 | </div> |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 239 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 240 | <p><tt>bugpoint</tt> will try to narrow down your list of passes to the one pass |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 241 | that causes an error, and simplify the bytecode file as much as it can to assist |
| 242 | you. It will print a message letting you know how to reproduce the resulting |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 243 | error.</p> |
| 244 | |
| 245 | </div> |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 246 | |
| 247 | <!-- *********************************************************************** --> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 248 | <div class="doc_section"> |
| 249 | <a name="codegen">Incorrect code generation</a> |
| 250 | </div> |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 251 | <!-- *********************************************************************** --> |
| 252 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 253 | <div class="doc_text"> |
| 254 | |
| 255 | <p>Similarly to debugging incorrect compilation by mis-behaving passes, you can |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 256 | debug incorrect code generation by either LLC or the JIT, using |
| 257 | <tt>bugpoint</tt>. The process <tt>bugpoint</tt> follows in this case is to try |
| 258 | to narrow the code down to a function that is miscompiled by one or the other |
| 259 | method, but since for correctness, the entire program must be run, |
| 260 | <tt>bugpoint</tt> will compile the code it deems to not be affected with the C |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 261 | Backend, and then link in the shared object it generates.</p> |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 262 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 263 | <p>To debug the JIT:</p> |
| 264 | |
Misha Brukman | f4e4feb | 2004-04-15 20:49:32 +0000 | [diff] [blame^] | 265 | <div class="doc_code"> |
| 266 | <p><tt><b>bugpoint</b> -run-jit -output=[correct output file] [bytecode file] |
| 267 | --args -- [program arguments]</tt></p> |
| 268 | </div> |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 269 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 270 | <p>Similarly, to debug the LLC, one would run:</p> |
| 271 | |
Misha Brukman | f4e4feb | 2004-04-15 20:49:32 +0000 | [diff] [blame^] | 272 | <div class="doc_code"> |
| 273 | <p><tt><b>bugpoint</b> -run-llc -output=[correct output file] [bytecode file] |
| 274 | --args -- [program arguments]</tt></p> |
| 275 | </div> |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 276 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 277 | <p>At the end of a successful <tt>bugpoint</tt> run, you will be presented |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 278 | with two bytecode files: a <em>safe</em> file which can be compiled with the C |
| 279 | backend and the <em>test</em> file which either LLC or the JIT |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 280 | mis-codegenerates, and thus causes the error.</p> |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 281 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 282 | <p>To reproduce the error that <tt>bugpoint</tt> found, it is sufficient to do |
| 283 | the following:</p> |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 284 | |
| 285 | <ol> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 286 | |
Misha Brukman | f4e4feb | 2004-04-15 20:49:32 +0000 | [diff] [blame^] | 287 | <li><p>Regenerate the shared object from the safe bytecode file:</p> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 288 | |
Misha Brukman | f4e4feb | 2004-04-15 20:49:32 +0000 | [diff] [blame^] | 289 | <div class="doc_code"> |
| 290 | <p><tt><b>llc</b> -march=c safe.bc -o safe.c<br> |
| 291 | <b>gcc</b> -shared safe.c -o safe.so</tt></p> |
| 292 | </div></li> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 293 | |
Misha Brukman | f4e4feb | 2004-04-15 20:49:32 +0000 | [diff] [blame^] | 294 | <li><p>If debugging LLC, compile test bytecode native and link with the shared |
| 295 | object:</p> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 296 | |
Misha Brukman | f4e4feb | 2004-04-15 20:49:32 +0000 | [diff] [blame^] | 297 | <div class="doc_code"> |
| 298 | <p><tt><b>llc</b> test.bc -o test.s -f<br> |
| 299 | <b>gcc</b> test.s safe.so -o test.llc<br> |
| 300 | ./test.llc [program options]</tt></p> |
| 301 | </div></li> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 302 | |
Misha Brukman | f4e4feb | 2004-04-15 20:49:32 +0000 | [diff] [blame^] | 303 | <li><p>If debugging the JIT, load the shared object and supply the test |
| 304 | bytecode:</p> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 305 | |
Misha Brukman | f4e4feb | 2004-04-15 20:49:32 +0000 | [diff] [blame^] | 306 | <div class="doc_code"> |
| 307 | <p><tt><b>lli</b> -load=safe.so test.bc [program options]</tt></p> |
| 308 | </div></li> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 309 | |
Misha Brukman | f1d01fb | 2003-09-17 18:51:47 +0000 | [diff] [blame] | 310 | </ol> |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 311 | |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 312 | </div> |
| 313 | |
Chris Lattner | 8b6be36 | 2003-05-21 22:21:07 +0000 | [diff] [blame] | 314 | <!-- *********************************************************************** --> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 315 | <hr> |
Misha Brukman | 637cab0 | 2004-01-15 19:03:47 +0000 | [diff] [blame] | 316 | <address> |
| 317 | <a href="http://jigsaw.w3.org/css-validator/check/referer"><img |
| 318 | src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a> |
| 319 | <a href="http://validator.w3.org/check/referer"><img |
| 320 | src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /></a> |
| 321 | |
| 322 | <a href="mailto:sabre@nondot.org">Chris Lattner</a><br> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 323 | <a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a> |
| 324 | <br> |
| 325 | Last modified: $Date$ |
Misha Brukman | 637cab0 | 2004-01-15 19:03:47 +0000 | [diff] [blame] | 326 | </address> |
Misha Brukman | 9408239 | 2003-10-31 18:37:20 +0000 | [diff] [blame] | 327 | |
| 328 | </body> |
| 329 | </html> |