[llvm-bugs] [Bug 52554] New: Argument promotion not happening for static function.

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 18 18:35:42 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=52554

            Bug ID: 52554
           Summary: Argument promotion not happening for static function.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Interprocedural Analyses
          Assignee: unassignedbugs at nondot.org
          Reporter: jmuizelaar at mozilla.com
                CC: llvm-bugs at lists.llvm.org

Given:

__attribute__((noinline))
static int foo(const int &x) {
    return x;
}

int r(int x) {
    return foo(x);
}

GCC gives:

foo(int const&) [clone .isra.0]:
        mov     eax, edi
        ret
r(int):
        jmp     foo(int const&) [clone .isra.0]


vs clang's:

r(int):                                  # @r(int)
        push    rax
        mov     dword ptr [rsp + 4], edi
        lea     rdi, [rsp + 4]
        call    foo(int const&)
        pop     rcx
        ret
foo(int const&):                             # @foo(int const&)
        mov     eax, dword ptr [rdi]
        ret

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211119/9848dbe4/attachment.html>


More information about the llvm-bugs mailing list