<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 - Missed optimization: AArch64 backend doesn’t elide function prologue/epilogue emission for noreturn+nounwind+!uwtable functions"
   href="https://bugs.llvm.org/show_bug.cgi?id=46667">46667</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Missed optimization: AArch64 backend doesn’t elide function prologue/epilogue emission for noreturn+nounwind+!uwtable functions
          </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>All
          </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>Backend: AArch64
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>vlad@tsyrklevich.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>arnaud.degrandmaison@arm.com, llvm-bugs@lists.llvm.org, smithp352@googlemail.com, Ties.Stuij@arm.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>AArch64FrameLowering doesn’t implement enableCalleeSaveSkip() [1], so it gets
the default base class implementation that always returns false. Simply
implementing this method to return true would slightly slim down
noreturn+nounwind+!uwtable functions.

For example:
$ cat noret.c
int puts(const char *s);

__attribute__((noreturn)) __attribute__((nothrow))
void mytrap(void) {
  puts("In mytrap\n");
  __builtin_trap();
}
$ clang -arch arm64 -Oz -c -o noret.o noret.c -fomit-frame-pointer
-fno-unwind-tables -msign-return-address=non-leaf
$ objdump -d noret.o

0000000000000000 ltmp0:
       0: 3f 23 03 d5                   paciasp
       4: fd 7b bf a9                   stp     x29, x30, [sp, #-16]!
       8: 00 00 00 90                   adrp    x0, #0
       c: 00 00 00 91                   add     x0, x0, #0
      10: 00 00 00 94                   bl      #0 <ltmp0+0x10>
      14: 20 00 20 d4                   brk     #0x1

If enableCalleeSaveSkip() were to return true on AArch64, the paciasp and stp
would be elided.

[1] <a href="https://reviews.llvm.org/D42898">https://reviews.llvm.org/D42898</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>