gOlogy: skip dbranch at -Og

Message ID orr2gd2sw7.fsf@lxoliva.fsfla.org
State New
Headers show
Series
  • gOlogy: skip dbranch at -Og
Related show

Commit Message

Alexandre Oliva Oct. 26, 2018, 5:12 a.m.
Delayed slot filling moves insns without any regard to variable
location notes, causing the location information in them to become
incorrect.

Fixing that appears to be quite difficult, but filling delay slots is
hardly an essential optimization to run at -Og, so if the user wants
to privilege debuggability, skip delay slot filling.

Regstrapped on sparc64-, x86- and x86_64-linux-gnu.  Also bootstrapped
on sparc64-linux-gnu with BOOT_CFLAGS='-Og -g' (needed
-Wno-error={{maybe-,}uninitialized,format-overflow}))

Ok to install?

for  gcc/ChangeLog

	* opts.c (default_options_table): Do not enable
	OPT_fdelayed_branch at -Og.
	* doc/invoke.texi (-fdelayed-branch): Document it.
---
 gcc/doc/invoke.texi |    3 ++-
 gcc/opts.c          |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)


-- 
Alexandre Oliva, freedom fighter   https://FSFLA.org/blogs/lxo
Be the change, be Free!         FSF Latin America board member
GNU Toolchain Engineer                Free Software Evangelist
Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe

Comments

Jeff Law Oct. 26, 2018, 2:30 p.m. | #1
On 10/25/18 11:12 PM, Alexandre Oliva wrote:
> Delayed slot filling moves insns without any regard to variable

> location notes, causing the location information in them to become

> incorrect.

> 

> Fixing that appears to be quite difficult, but filling delay slots is

> hardly an essential optimization to run at -Og, so if the user wants

> to privilege debuggability, skip delay slot filling.

> 

> Regstrapped on sparc64-, x86- and x86_64-linux-gnu.  Also bootstrapped

> on sparc64-linux-gnu with BOOT_CFLAGS='-Og -g' (needed

> -Wno-error={{maybe-,}uninitialized,format-overflow}))

> 

> Ok to install?

> 

> for  gcc/ChangeLog

> 

> 	* opts.c (default_options_table): Do not enable

> 	OPT_fdelayed_branch at -Og.

> 	* doc/invoke.texi (-fdelayed-branch): Document it.

OK.
jeff

Patch

diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 57491f1033cf..052a0999a590 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -8585,7 +8585,8 @@  If supported for the target machine, attempt to reorder instructions
 to exploit instruction slots available after delayed branch
 instructions.
 
-Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os},
+but not at @option{-Og}.
 
 @item -fschedule-insns
 @opindex fschedule-insns
diff --git a/gcc/opts.c b/gcc/opts.c
index 3b61e17a7ab0..34c283dd7655 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -442,7 +442,7 @@  static const struct default_options default_options_table[] =
     /* -O1 optimizations.  */
     { OPT_LEVELS_1_PLUS, OPT_fdefer_pop, NULL, 1 },
 #if DELAY_SLOTS
-    { OPT_LEVELS_1_PLUS, OPT_fdelayed_branch, NULL, 1 },
+    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fdelayed_branch, NULL, 1 },
 #endif
     { OPT_LEVELS_1_PLUS, OPT_fguess_branch_probability, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_fcprop_registers, NULL, 1 },