<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 - Reg alloc reloads register three times in innermost vector loop, although there are many free regs"
   href="https://bugs.llvm.org/show_bug.cgi?id=32722">32722</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Reg alloc reloads register three times in innermost vector loop, although there are many free regs
          </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
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18320" name="attach_18320" title="reduced test case">attachment 18320</a> <a href="attachment.cgi?id=18320&action=edit" title="reduced test case">[details]</a></span>
reduced test case

I noticed that there are reloads of a register which is used as an address
inside a vectorized loop.

The loop is innermost, is a single block, and there are 10 unused registers in
the loop.

I am thinking that RA should be able to split live ranges around the loop?

bin/llc -O3 -mtriple=s390x-linux-gnu -mcpu=z13 -o out.s vecloopspills.ll


.LBB0_18:                               # %vector.body
                                        # =>This Inner Loop Header: Depth=1
        lgfr    %r5, %r3
        sllg    %r5, %r5, 3
        vlrepg  %v0, 0(%r5,%r14)
        ahik    %r14, %r3, -2
        lg      %r13, 200(%r15)         # 8-byte Folded Reload
        lgfr    %r14, %r14
        sllg    %r14, %r14, 3
        vlrepg  %v1, 0(%r14,%r13)
        vmrhg   %v0, %v1, %v0
        lg      %r13, 200(%r15)         # 8-byte Folded Reload
        vflcdb  %v0, %v0
        vsteg   %v0, 0(%r14,%r13), 0
        lg      %r14, 200(%r15)         # 8-byte Folded Reload
        ahi     %r3, 4
        aghi    %r4, -2
        vsteg   %v0, 0(%r5,%r14), 1
        jne     .LBB0_18</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>