This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Turn on -fomit-frame-pointer by default for 32bit Linux/x86
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Richard Guenther <richard dot guenther at gmail dot com>
- Cc: Andrew Pinski <pinskia at gmail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Mon, 2 Aug 2010 10:54:59 -0700
- Subject: Re: PATCH: Turn on -fomit-frame-pointer by default for 32bit Linux/x86
- References: <AANLkTinR6uC2_Vqd+_R17KO+_zL0+FwJFPYPLxu0Jkdc@mail.gmail.com>
On Mon, Jul 26, 2010 at 9:33 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Wed, Jul 14, 2010 at 2:55 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Wed, Jul 14, 2010 at 6:46 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>> On Wed, Jul 14, 2010 at 1:09 AM, Richard Guenther
>>> <richard.guenther@gmail.com> wrote:
>>>> On Tue, Jul 13, 2010 at 11:44 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>> On Tue, Jul 13, 2010 at 2:02 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>>> On Tue, Jul 13, 2010 at 2:01 PM, Andrew Pinski <pinskia@gmail.com> wrote:
>>>>>>> On Tue, Jul 13, 2010 at 1:59 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>>>>>>> What will stop working when -fomit-frame-pointer is on?
>>>>>>>
>>>>>>> backtraces when debugging information is not turned on.
>>>>>>
>>>>>> See http://gcc.gnu.org/ml/gcc-patches/2004-08/msg01033.html and many
>>>>>> more. ?This is not the first time this has been discussed.
>>>>>
>>>>> Most of 32bit x86 assembly codes in glibc have .eh_frame section.
>>>>> If backtrace is absolutely needed, they can add -fasynchronous-unwind-tables
>>>>> or -fno-omit-frame-pointer.
>>>>
>>>> We build opensuse with -fomit-frame-pointer -fasynchronous-unwind-tables.
>>>> If you want to make -fomit-frame-pointer the default then you should enable
>>>> unwind tables by default.
>>>>
>>>
>>> I will try and make it target/OS dependent.
>>>
>>
>> Here is a patch. How does it look?
>>
>
> Here are the updated patch and spread sheet for SPEC CPU 2000/2006 on
> Intel Core i7 which shows that -fomit-frame-pointer -fasynchronous-unwind-tables
> improves performance by up to 12% at -O2 and 8% at -O3. For -Os, it improves
> performance by up to 20%, but also increases code by up to 36%.
>
> This patch turns on -fomit-frame-pointer -fasynchronous-unwind-tables only if
> -Os isn't used.
>
> Tested on Linux/ia32 and Linux/x86-64 with -m32. OK for trunk?
Any comments on this patch. Any objections?
Thanks.
H.J.
---
> Thanks.
>
> --
> H.J.
> ---
> gcc/
>
> 2010-07-25 ?H.J. Lu ?<hongjiu.lu@intel.com>
>
> ? ? ? ?* config/i386/i386.c (override_options): For 32bit, default
> ? ? ? ?flag_omit_frame_pointer and flag_asynchronous_unwind_tables
> ? ? ? ?to TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT and
> ? ? ? ?TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT.
>
> ? ? ? ?* config/i386/i386.h (TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT):
> ? ? ? ?New.
> ? ? ? ?(TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT): Likewise.
> ? ? ? ?* config/i386/linux.h (TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT):
> ? ? ? ?Likewise.
> ? ? ? ?(TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT): Likewise.
> ? ? ? ?* config/i386/linux64.h (TARGET_SUBTARGET32_OMIT_FRAME_POINTER_DEFAULT):
> ? ? ? ?Likewise.
> ? ? ? ?(TARGET_SUBTARGET32_ASYNCHRONOUS_UNWIND_TABLES_DEFAULT): Likewise.
>
> gcc/testsuite/
>
> 2010-07-25 ?H.J. Lu ?<hongjiu.lu@intel.com>
>
> ? ? ? ?* gcc.target/i386/frame-pointer-1.c: New.
> ? ? ? ?* gcc.target/i386/frame-pointer-2.c: Likewise.
> ? ? ? ?* gcc.target/i386/frame-pointer-3.c: Likewise.
> ? ? ? ?* gcc.target/i386/frame-pointer-4.c: Likewise.
> ? ? ? ?* gcc.target/i386/frame-pointer-5.c: Likewise.
>