<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - llc code generation error"
   href="http://llvm.org/bugs/show_bug.cgi?id=16216">16216</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llc code generation error
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>llc
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>keid.llvm@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=10627" name="attach_10627" title="annotated LLVM .ll file">attachment 10627</a> <a href="attachment.cgi?id=10627&action=edit" title="annotated LLVM .ll file">[details]</a></span>
annotated LLVM .ll file

This is an llc code generation error.  It appears with the attached .ll file
with trunk (as of last and this week), but not 3.1 or 3.2 which produce
identical code that is quite different than what what trunk produces.

This bug appears when using llc -O0 on the attached .ll file.  Examining the
x86 assembly llc produces, it is clear that a x86 register values gets stomped
on before use, specifically the dividend in EAX before the division operation. 
This error can be made to disappear by reducing register
pressure/spills-reloads by making changes as described below.

lli produces correct results.  Higher levels of llc optimization produce
correct results.

The attached code has the relevant chunk of code marked with

;; aaa[indvar] = aa[indvar] / a[indvar]

Running the code with llc -O0 will produce incorrect output.  Making either of
the changes in the following ;; comments in the code will make the error
disappear (EAX doesn't get stepped on before use).</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>