[llvm-bugs] [Bug 51255] New: tail call applied to __attribute__((no_caller_saved_registers)) negates its purpose
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jul 28 14:15:17 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51255
Bug ID: 51255
Summary: tail call applied to
__attribute__((no_caller_saved_registers)) negates its
purpose
Product: clang
Version: 12.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: thiago at kde.org
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
neeilans at live.com, richard-llvm at metafoo.co.uk
$ clang --version
clang version 12.0.1
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ cat test.c
// general-regs-only is helpful with Clang trunk
__attribute__((target("general-regs-only"), no_caller_saved_registers))
int g(int (*f)(void))
{
return f();
}
$ clang -O2 -S -o - -mgeneral-regs-only test.c
[ see result with clang trunk at https://clang.godbolt.org/z/rMzaPjhn3 ]
g(int (*)()): # @g(int (*)())
pushq %r11
pushq %r10
pushq %r9
pushq %r8
pushq %rsi
pushq %rdx
pushq %rcx
pushq %rax
popq %rax
popq %rcx
popq %rdx
popq %rsi
popq %r8
popq %r9
popq %r10
popq %r11
jmpq *%rdi # TAILCALL
The register preservation does not encompass the actual function call.
--
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/20210728/ac740985/attachment-0001.html>
More information about the llvm-bugs
mailing list