[llvm-dev] clang emits calls to consexpr function. (original) (raw)
kamlesh kumar via llvm-dev llvm-dev at lists.llvm.org
Tue Feb 5 04:41:30 PST 2019
- Previous message: [llvm-dev] [RFC] [CMake] Removing support for LLVM_TOOL_ CMake cache variables
- Next message: [llvm-dev] clang emits calls to consexpr function.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Devs, consider below testcase
$cat test.cpp
constexpr int product() {
return 10*20;
} int main() { const int x = product(); return 0; }
$./clang test.cpp -std=c++11 -S $./clang -v clang version 9.0.0 Target: x86_64-unknown-linux-gnu
$cat test.s
main: .cfi_startproc
%bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
movq %rsp, %rbp
.cfi_def_cfa_register %rbp
subq $16, %rsp
movl $0, -4(%rbp)
callq _Z7productv //here you can see the calls to product
function xorl %ecx, %ecx movl %eax, -8(%rbp) movl %ecx, %eax addq $16, %rsp popq %rbp .cfi_def_cfa %rsp, 8 retq
while g++ do not emits calls to constexpr function $g++ test.cpp -std=c++11 $cat test.s main: .LFB1: .cfi_startproc pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl $200, -4(%rbp) movl $0, %eax popq %rbp .cfi_def_cfa 7, 8 ret .cfi_endproc
is this bug in clang compiler? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190205/ea40cfba/attachment.html>
- Previous message: [llvm-dev] [RFC] [CMake] Removing support for LLVM_TOOL_ CMake cache variables
- Next message: [llvm-dev] clang emits calls to consexpr function.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]