<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 - [PPC64/PPC64LE] Call of __attribute__((noreturn)) generates suboptimal code"
   href="https://bugs.llvm.org/show_bug.cgi?id=40021">40021</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[PPC64/PPC64LE] Call of __attribute__((noreturn)) generates suboptimal code
          </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>Backend: PowerPC
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>simonas+llvm.org@kazlauskas.me
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, nemanja.i.ibm@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21223" name="attach_21223" title="LLVM-IR test case">attachment 21223</a> <a href="attachment.cgi?id=21223&action=edit" title="LLVM-IR test case">[details]</a></span>
LLVM-IR test case

The following C code

typedef long long unsigned int uint64_t;

void __attribute__((noreturn)) test(uint64_t a, uint64_t b, uint64_t
__attribute__((noreturn)) (*cb)(uint64_t, uint64_t)) {
    cb(a, b);
}

which generates the following LLVM-IR (clang 6)

define void @test(i64, i64, i64 (i64, i64)* nocapture) local_unnamed_addr #0 {
  %4 = tail call i64 %2(i64 %0, i64 %1) #1
  unreachable
}

results in unnecessary instructions after the call when ppc64le is targeted:

mtctr 5
mr 12, 5
std 2, 24(1) /* what for? */
bctrl
ld 2, 24(1)  /* what for? */

The full LLVM-IR is attached.</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>