Skip to content

Leaf functions that don't use the frame set up a frame anyway #9493

@llvmbot

Description

@llvmbot
Bugzilla Link 9121
Resolution FIXED
Resolved on Feb 02, 2011 00:43
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @lattner,@nlewycky

Extended Description

For example:

test.cc:
#include
long foo(std::vector&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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions