[x86] Do not omit the frame pointer at -O0

Message ID 6483947.mOsC1xWP0l@polaris
State New
Headers show
Series
  • [x86] Do not omit the frame pointer at -O0
Related show

Commit Message

Eric Botcazou June 20, 2018, 1:56 p.m.
Hi,

the fix for PR target/81736 unconditionally overrules -fno-omit-frame-pointer, 
including at -O0 where it is implicit.  That seems brutal and unnecessary so 
the attached patch reverts it at -O0 and thus fixes 135 failures in the GDB 
testsuite:

                === gdb Summary ===
 
-# of expected passes           55397
-# of unexpected failures       359
+# of expected passes           55534
+# of unexpected failures       224
 # of unexpected successes      3
 # of expected failures         64
 # of unknown successes         3

Tested on x86-64/Linux, OK for mainline and 8 branch?


2018-06-20  Eric Botcazou  <ebotcazou@adacore.com>

	* config/i386/i386.c (ix86_finalize_stack_frame_flags): Do not overrule
	-fno-omit-frame-pointer when not optimizing.

-- 
Eric Botcazou

Comments

Jeff Law June 22, 2018, 8:36 p.m. | #1
On 06/20/2018 07:56 AM, Eric Botcazou wrote:
> Hi,

> 

> the fix for PR target/81736 unconditionally overrules -fno-omit-frame-pointer, 

> including at -O0 where it is implicit.  That seems brutal and unnecessary so 

> the attached patch reverts it at -O0 and thus fixes 135 failures in the GDB 

> testsuite:

> 

>                 === gdb Summary ===

>  

> -# of expected passes           55397

> -# of unexpected failures       359

> +# of expected passes           55534

> +# of unexpected failures       224

>  # of unexpected successes      3

>  # of expected failures         64

>  # of unknown successes         3

> 

> Tested on x86-64/Linux, OK for mainline and 8 branch?

> 

> 

> 2018-06-20  Eric Botcazou  <ebotcazou@adacore.com>

> 

> 	* config/i386/i386.c (ix86_finalize_stack_frame_flags): Do not overrule

> 	-fno-omit-frame-pointer when not optimizing.

> 

OK
jeff

Patch

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 8a0baed5e02..d7dad81786a 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -13328,7 +13328,7 @@  ix86_finalize_stack_frame_flags (void)
      is used, but in the end nothing that needed the stack alignment had
      been spilled nor stack access, clear frame_pointer_needed and say we
      don't need stack realignment.  */
-  if ((stack_realign || !flag_omit_frame_pointer)
+  if ((stack_realign || (!flag_omit_frame_pointer && optimize))
       && frame_pointer_needed
       && crtl->is_leaf
       && crtl->sp_is_unchanging