<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - An empty exit block produced by LoopSimplify increases spilling"
   href="https://bugs.llvm.org/show_bug.cgi?id=43061">43061</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>An empty exit block produced by LoopSimplify increases spilling
          </td>
        </tr>

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

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Register Allocator
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>paulsson@linux.vnet.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, quentin.colombet@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22400" name="attach_22400" title="llc input">attachment 22400</a> <a href="attachment.cgi?id=22400&action=edit" title="llc input">[details]</a></span>
llc input

I was experimenting with a pre-isl loop pass and found that by running the
LoopSimplify pass I saw generally more spilling. This happened also when I
turned off my optimization, so that *only* canonicalization of loop was the
difference.

I am not sure this is something worth looking into, but it looks like a
potential area improvement since an empty block after a loop (exit block) by
itself does not change the register allocation problem.

llc -mcpu=z14 ./tc.mir -o out.0.s -start-before=greedy
llc -mcpu=z14 ./tc.emptyexitblock.mir -o out.1.s -start-before=greedy

out.1.s has one more spilled interval, around the loop. The only (real)
difference between the two mir files is:

<   bb66:                                             ; preds = %bb51, %bb19    
---
<span class="quote">>   bb66.loopexit:                                    ; preds = %bb51
>     br label %bb66</span >
>
<span class="quote">>   bb66:                                             ; preds = %bb66.loopexit,</span ></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>