This could affect performance slightly in real-world code if virtual functions are used to return constants in some overrides. test.d: int main() { return 0; } dmd -c -O -inline -release test.d Disassembly of _Dmain in test.o: _Dmain PROC push rbp ; 0000 _ 55 mov rbp, rsp ; 0001 _ 48: 8B. EC xor eax, eax ; 0004 _ 31. C0 pop rbp ; 0006 _ 5D ret ; 0007 _ C3 _Dmain ENDP Do we really need to do the push rbp; mov rbp, rsp; pop rbp when the function doesn't actually use any stack and just sets eax to zero and returns? GDC elides these extra instructions. In GDC, compiled with -O1 or higher, _Dmain's body is: _Dmain PROC xor eax, eax ; 0000 _ 31. C0 ret ; 0002 _ C3 _Dmain ENDP
I believe this was fixed by this pull request: https://github.com/dlang/dmd/pull/5040