[Bug target/57293] New: [4.8/4.9 Regression] not needed frame pointers on IA-32 (performance regression?)
fanael4 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed May 15 16:08:00 GMT 2013
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)
More information about the Gcc-bugs
mailing list