<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 - tail call causes to run out of registers during register allocation"
   href="https://bugs.llvm.org/show_bug.cgi?id=42062">42062</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>tail call causes to run out of registers during register allocation
          </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>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>Backend: ARM
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>diogo.sampaio@arm.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>diogo.sampaio@arm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, peter.smith@linaro.org, Ties.Stuij@arm.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>llc in the code:
--
target triple = "thumbv8m.base-arm-none-eabi"
@foo = external global i8
declare i32 @bar(i8* nocapture, i32, i32, i8* nocapture) 

define void @food(i8* %a) #0 {
entry:
  %0 = tail call i32 @bar(i8* %a, i32 8, i32 1, i8* nonnull @foo)
  %1 = tail call i32 @bar(i8* %a, i32 9, i32 0, i8* nonnull @foo)
  %2 = tail call i32 @bar(i8* %a, i32 7, i32 2, i8* nonnull @foo)
  ret void
}
attributes #0 = { minsize "target-cpu"="cortex-m23" }
--
will produce an error: ran out of registers during register allocation

running --disable-tail-calls won't

In thumb there are only 8 registers. In this particular case, the register
allocator could move the bar address, stored in r6 to register r7 and allow the
register r4, r5, r6 to be restored. But he does not.</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>