[LLVMbugs] [Bug 9121] New: Leaf functions that don't use the frame set up a frame anyway

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 1 15:02:59 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=9121

           Summary: Leaf functions that don't use the frame set up a frame
                    anyway
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: nicholas at mxc.ca, llvmbugs at cs.uiuc.edu


For example:

test.cc:
#include <vector>
long foo(std::vector<int>&v) {
  return v.size();
}


g++-4.6svn -S test.cc -o - -O2 -m32:
_Z3fooRSt6vectorIiSaIiEE:
.LFB442:
        movl    4(%esp), %edx
        movl    4(%edx), %eax
        subl    (%edx), %eax
        sarl    $2, %eax
        ret

g++-4.6svn -S test.cc -o - -O2 -m64:
_Z3fooRSt6vectorIiSaIiEE:
.LFB442:
        movq    8(%rdi), %rax
        subq    (%rdi), %rax
        sarq    $2, %rax
        ret


clang++ -S test.cc -o - -O2 -m32
_Z3fooRSt6vectorIiSaIiEE:               # @_Z3fooRSt6vectorIiSaIiEE
# BB#0:                                 # %entry
        pushl   %ebp
        movl    %esp, %ebp
        movl    8(%ebp), %ecx
        movl    4(%ecx), %eax
        subl    (%ecx), %eax
        sarl    $2, %eax
        popl    %ebp
        ret

clang++ -S test.cc -o - -O2 -m64:
_Z3fooRSt6vectorIiSaIiEE:               # @_Z3fooRSt6vectorIiSaIiEE
.Leh_func_begin0:
# BB#0:                                 # %entry
        pushq   %rbp
.Ltmp0:
        movq    %rsp, %rbp
.Ltmp1:
        movq    8(%rdi), %rax
        subq    (%rdi), %rax
        sarq    $2, %rax
        popq    %rbp
        ret

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list