www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21007] New: DMD generates unnecessary prolog/epilog for

https://issues.dlang.org/show_bug.cgi?id=21007

          Issue ID: 21007
           Summary: DMD generates unnecessary prolog/epilog for trivial
                    functions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

The code:

    int square(int num) {  return num * num; }

generates:

    push    RBP
    mov     RBP,RSP
    mov     EAX,EDI
    imul    EAX,EAX
    pop     RBP
    ret

while gdc and ldc do not generate the prolog/epilog.

https://godbolt.org/z/A7EUu7

--
Jul 01