https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115998

            Bug ID: 115998
           Summary: Redundant stack pointer manipulation
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: user202729 at protonmail dot com
  Target Milestone: ---

Code:

int g(int, int);
int l(){
    return g(g(0, 0), 0);
}

Assembly:

l():
        sub     rsp, 8
        xor     esi, esi
        xor     edi, edi
        call    g(int, int)
        xor     esi, esi
        add     rsp, 8
        mov     edi, eax
        jmp     g(int, int)

The manipulation of rsp looks redundant to me.

Godbolt: https://godbolt.org/z/bcshxvza6

Looks related to pr94173, but this doesn't look like an alignment issue.

Reply via email to