<html>
    <head>
      <base href="https://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 --- - Register Spills Caused by the Machine Reassociation Optimization"
   href="https://llvm.org/bugs/show_bug.cgi?id=25016">25016</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Register Spills Caused by the Machine Reassociation Optimization
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>Scalar Optimizations
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>haicheng@codeaurora.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mssimpso@codeaurora.org, spatel+llvm@rotateright.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14976" name="attach_14976" title="a .ll test case that delays the addition of the first number">attachment 14976</a> <a href="attachment.cgi?id=14976&action=edit" title="a .ll test case that delays the addition of the first number">[details]</a></span>
a .ll test case that delays the addition of the first number

I observed some extra register spills when applying the reassociation pass on
some programs.

For example, code like this


X=a+b

Y=X+c

Z=Y+d


There are some other instructions between these float adds.  The reassociation
pass first swaps a and c when checking the second add, and then swaps a and d
when checking the third add.  The transformed code looks like


X=c+b

Y=X+d

Z=Y+a

a is pushed all the way down to the bottom and its live range is much larger
now.  

A .ll test case is attached which computes a+b+c+d+e+f+g+h.  The transformation
delays the computation of a to the end and it becomes b+c+d+e+f+g+h+a</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>