When I disassemble some C++ code, sometimes I see assembler doing like this:
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
Isn't the second instruction useless? Why is it here?
Compiled with clang8 in debug mode with no specified optimization level. It only remains with -O0 level, with -O1, -O2, -O3 it disappears.