<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 --- - AArch64-ios: Cannot scavenge register without an emergency spill slot"
   href="https://llvm.org/bugs/show_bug.cgi?id=27717">27717</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>AArch64-ios: Cannot scavenge register without an emergency spill slot
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>Register Allocator
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>alina.sbirlea@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16361" name="attach_16361" title="Test showing the failure.">attachment 16361</a> <a href="attachment.cgi?id=16361&action=edit" title="Test showing the failure.">[details]</a></span>
Test showing the failure.

Running "llc fail.ll" yields assertion failure "Cannot scavenge register
without an emergency spill slot" on aarch64-ios. See attached "fail.ll"

This is caused by not finding a register to scavenge, no architecture specific
handling and because on MachO there isn't an emergency spill slot added.
See line lib/Target/AArch64/AArch64FrameLowering.cpp:1127:
    // MachO's compact unwind format relies on all registers being stored in
    // pairs.
    // FIXME: the usual format is actually better if unwinding isn't needed.
    if (produceCompactUnwindFrame(MF) && !SavedRegs.test(PairedReg)) {
      SavedRegs.set(PairedReg);
      ExtraCSSpill = true;
    }


Unsetting "ExtraCSSpill = true;"(AArch64FrameLowering.cpp:1129) resolves the
issue, but I am unsure this is the right solution.


Side note:
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - ARMv7 -O0: Cannot scavenge register without an emergency spill slot!"
   href="show_bug.cgi?id=23444">Bug 23444</a> seemed to be a duplicate at first, but the problem does not reproduce
in the example provided (fn06.bc). <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - ARMv7 -O0: Cannot scavenge register without an emergency spill slot!"
   href="show_bug.cgi?id=23444">Bug 23444</a> may be fixed.</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>