[Bug c/106116] New: Missed optimization: in no_reorder-attributed functions, tail calls to the subsequent function could just be function-to-function fallthrough

pskocik at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Jun 28 11:51:58 GMT 2022


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

            Bug ID: 106116
           Summary: Missed optimization: in no_reorder-attributed
                    functions, tail calls to the subsequent function could
                    just be function-to-function fallthrough
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pskocik at gmail dot com
  Target Milestone: ---

Example:

__attribute((noinline,no_reorder))
int fnWithExplicitArg(int ExplicitArg);

__attribute((noinline,no_reorder))
int fnWithDefaultArg(void){ return fnWithExplicitArg(42); }

int fnWithExplicitArg(int ExplicitArg){
    int useArg(int);
        return 12+useArg(ExplicitArg);
}

Generated fnWithDefaultArg:

fnWithDefaultArg:
        mov     edi, 42
        jmp     fnWithExplicitArg
fnWithExplicitArg:
        //...

Desired fnWithDefaultArg


fnWithDefaultArg:
        mov     edi, 42
        //fallthru
fnWithExplicitArg:
        //...

https://gcc.godbolt.org/z/Ph3onxoh9


More information about the Gcc-bugs mailing list