[llvm-bugs] [Bug 40021] New: [PPC64/PPC64LE] Call of __attribute__((noreturn)) generates suboptimal code

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Dec 14 04:44:09 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=40021

            Bug ID: 40021
           Summary: [PPC64/PPC64LE] Call of __attribute__((noreturn))
                    generates suboptimal code
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: PowerPC
          Assignee: unassignedbugs at nondot.org
          Reporter: simonas+llvm.org at kazlauskas.me
                CC: llvm-bugs at lists.llvm.org, nemanja.i.ibm at gmail.com

Created attachment 21223
  --> https://bugs.llvm.org/attachment.cgi?id=21223&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181214/76c27a58/attachment.html>


More information about the llvm-bugs mailing list