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: unassignedb...@nondot.org
          Reporter: jmuizel...@mozilla.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to