+<div class="doc_text">
+
+<p>Similarly to debugging incorrect compilation by mis-behaving passes, you can
+debug incorrect code generation by either LLC or the JIT, using
+<tt>bugpoint</tt>. The process <tt>bugpoint</tt> follows in this case is to try
+to narrow the code down to a function that is miscompiled by one or the other
+method, but since for correctness, the entire program must be run,
+<tt>bugpoint</tt> will compile the code it deems to not be affected with the C
+Backend, and then link in the shared object it generates.</p>
+
+<p>To debug the JIT:</p>
+
+<pre>
+ <b>bugpoint</b> -run-jit -output=[correct output file] [bytecodefile]
+</pre>
+
+<p>Similarly, to debug the LLC, one would run:</p>
+
+<pre>
+ <b>bugpoint</b> -run-llc -output=[correct output file] [bytecodefile]
+</pre>
+
+<p>At the end of a successful <tt>bugpoint</tt> run, you will be presented
+with two bytecode files: a <em>safe</em> file which can be compiled with the C
+backend and the <em>test</em> file which either LLC or the JIT
+mis-codegenerates, and thus causes the error.</p>
+
+<p>To reproduce the error that <tt>bugpoint</tt> found, it is sufficient to do
+the following:</p>
+
+<ol>
+
+ <li>Regenerate the shared object from the safe bytecode file:<br>
+
+<pre>
+ <b>llvm-dis</b> -c safe.bc -o safe.c<br>
+ <b>gcc</b> -shared safe.c -o safe.so
+</pre></li>
+
+ <li>If debugging LLC, compile test bytecode native and link with the shared object:<br>
+
+<pre>
+ <b>llc</b> test.bc -o test.s -f<br>
+ gcc test.s safe.so -o test.llc<br>
+ ./test.llc [program options]
+</pre></li>
+
+<p>If debugging the JIT, load the shared object and supply the test
+bytecode:</p>
+
+<pre>
+ <b>lli</b> -load=safe.so test.bc [program options]
+</pre></li>
+
+</ol>
+
+</div>
+
+<!-- *********************************************************************** -->
+
+<hr>
+<div class="doc_footer">
+ <address><a href="mailto:sabre@nondot.org">Chris Lattner</a></address>
+ <a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a>
+ <br>
+ Last modified: $Date$
+</div>
+
+</body>
+</html>