Unnecessary stores with std::optional?
Tue May 26 13:07:10 GMT 2020
Dear GCC community,
I was testing std::optional when I noticed that gcc produces stores that
don't seem to be required.
auto r = foo();
What gcc 10.1 with -std=c++17 -O3 produces is:
sub rsp, 24
mov QWORD PTR [rsp+8], rdx
cmp BYTE PTR [rsp+8], 0
mov QWORD PTR [rsp], rax
mov rax, QWORD PTR [rsp]
xor eax, eax
add rsp, 24
I don't understand the stores (and loads) after the call to foo. They
don't seem necessary to me. Can anyone explain them to me?
More information about the Gcc-help