public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/57293] New: [4.8/4.9 Regression] not needed frame pointers on IA-32 (performance regression?)
@ 2013-05-15 16:08 fanael4 at gmail dot com
  2013-05-16 10:16 ` [Bug target/57293] " rguenth at gcc dot gnu.org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: fanael4 at gmail dot com @ 2013-05-15 16:08 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57293

            Bug ID: 57293
           Summary: [4.8/4.9 Regression] not needed frame pointers on
                    IA-32 (performance regression?)
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fanael4 at gmail dot com

About a week ago GCC started to emit frame pointers even in presence of
-fomit-frame-pointer whenever there's a call to a function with a "callee
cleans up the arguments" calling convention. Normally it wouldn't be a big
deal, but IA-32 is seriously register-starved, and since one of the secondary
platforms (i.e. Windows) uses __thiscall__ for C++ member functions by default,
for some code the availability of ebp can make a noticeable difference. I can
provide a benchmark if one is needed.

The culprit seems to be revisions 198140 and 198555.

Testcase:

/* compile with -O2 -fomit-frame-pointer */
__attribute__((__noinline__, __noclone__, __stdcall__)) void g(int a)
{
  __builtin_printf("in g(): %d\n", a);
}

__attribute__((__noinline__, __noclone__, __thiscall__)) void h(int a, int b)
{
  __builtin_printf("in h(): %d %d\n", a, b);
}

void f()
{
  g(0);
  h(0, 1);
  __builtin_puts("in f()");
}

What GCC 4.7.0 and 4.8.1 20130430 produce for f :

_f:
LFB2:
        .cfi_startproc
        subl    $28, %esp
        .cfi_def_cfa_offset 32
        movl    $0, (%esp)
        call    _g@4
        .cfi_def_cfa_offset 28
        xorl    %ecx, %ecx
        subl    $4, %esp
        .cfi_def_cfa_offset 32
        movl    $1, (%esp)
        call    _h
        .cfi_def_cfa_offset 28
        subl    $4, %esp
        .cfi_def_cfa_offset 32
        movl    $LC2, (%esp)
        call    _puts
        addl    $28, %esp
        .cfi_def_cfa_offset 4
        ret
        .cfi_endproc

What 4.8.1 20130510 produces:

_f:
LFB2:
        .cfi_startproc
        pushl   %ebp
        .cfi_def_cfa_offset 8
        .cfi_offset 5, -8
        movl    %esp, %ebp
        .cfi_def_cfa_register 5
        subl    $24, %esp
        movl    $0, (%esp)
        call    _g@4
        xorl    %ecx, %ecx
        subl    $4, %esp
        movl    $1, (%esp)
        call    _h
        subl    $4, %esp
        movl    $LC2, (%esp)
        call    _puts
        leave
        .cfi_restore 5
        .cfi_def_cfa 4, 4
        ret
        .cfi_endproc

Target: i686-w64-mingw32
Configured with: ../../src/gcc-svn/configure --build=x86_64-unknown-linux-gnu
--host=i686-w64-mingw32 --target=i686-w64-mingw32 --disable-multilib
--disable-multiarch --disable-nls --enable-languages=c,c++,lto
--disable-win32-registry --enable-openmp --enable-libgomp
--enable-threads=posix --enable-plugins --enable-static --enable-shared
--disable-symvers --enable-fully-dynamic-string --disable-sjlj-exceptions
--disable-libstdcxx-pch --enable-libstdcxx-time --with-arch=i686
--enable-checking=release --disable-werror --with-gnu-as --with-gnu-ld
--disable-rpath --with-gmp=/mingw/i686-final/libs-out-dir
--with-mpfr=/mingw/i686-final/libs-out-dir
--with-mpc=/mingw/i686-final/libs-out-dir
--with-isl=/mingw/i686-final/libs-out-dir
--with-cloog=/mingw/i686-final/libs-out-dir
--with-libiconv-prefix=/mingw/i686-final/libs-out-dir --with-system-zlib
--prefix=/mingw/i686-final/out-dir
Thread model: posix
gcc version 4.8.1 20130510 (prerelease) (GCC)


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-01-16 21:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-15 16:08 [Bug target/57293] New: [4.8/4.9 Regression] not needed frame pointers on IA-32 (performance regression?) fanael4 at gmail dot com
2013-05-16 10:16 ` [Bug target/57293] " rguenth at gcc dot gnu.org
2013-05-16 15:36 ` vmakarov at redhat dot com
2013-05-16 15:44 ` jakub at gcc dot gnu.org
2013-05-17 10:32 ` fanael4 at gmail dot com
2013-08-04 12:45 ` fanael4 at gmail dot com
2013-08-04 15:02 ` vmakarov at redhat dot com
2013-10-16  9:49 ` jakub at gcc dot gnu.org
2013-10-30 12:21 ` rguenth at gcc dot gnu.org
2013-11-26 20:01 ` vmakarov at gcc dot gnu.org
2013-11-26 20:23 ` vmakarov at gcc dot gnu.org
2013-11-28 21:45 ` vmakarov at gcc dot gnu.org
2014-01-16 21:01 ` law at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).