diff options
author | Marc Glisse <marc.glisse@inria.fr> | 2020-06-19 12:07:33 +0100 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 13:14:13 -0300 |
commit | e21ad1d77174f63b5835d2f71c04ab9d5aea58a6 (patch) | |
tree | a6c7551ae9d02fa7632f2b7aec5ac778c302a06c /gcc/fortran/iresolve.c | |
parent | 69f84939fc2f6712e264948fead0876538dd83d3 (diff) | |
download | gcc-e21ad1d77174f63b5835d2f71c04ab9d5aea58a6.zip gcc-e21ad1d77174f63b5835d2f71c04ab9d5aea58a6.tar.gz gcc-e21ad1d77174f63b5835d2f71c04ab9d5aea58a6.tar.bz2 |
libstdc++: Optimize std::optional default constructor
The attached patch changes the code generated for
std::optional<std::array<int,1024>>f(){return{};}
from
movq $0, (%rdi)
movq %rdi, %r8
leaq 8(%rdi), %rdi
xorl %eax, %eax
movq $0, 4084(%rdi)
movq %r8, %rcx
andq $-8, %rdi
subq %rdi, %rcx
addl $4100, %ecx
shrl $3, %ecx
rep stosq
movq %r8, %rax
or with different tuning
subq $8, %rsp
movl $4100, %edx
xorl %esi, %esi
call memset
addq $8, %rsp
to the much shorter
movb $0, 4096(%rdi)
movq %rdi, %rax
i.e. the same as the nullopt constructor.
The constructor was already non-trivial, so we don't lose that. It passes the
testsuite without regression, but there is no new testcase to verify the
better codegen.
libstdc++-v3/ChangeLog:
* include/std/optional (optional()): Explicitly define it.
Diffstat (limited to 'gcc/fortran/iresolve.c')
0 files changed, 0 insertions, 0 deletions