From f4baf89f7c7cef908c23081f35b3f9fc226c0d12 Mon Sep 17 00:00:00 2001 From: Alexandre Oliva Date: Thu, 1 Nov 2018 01:23:08 +0000 Subject: [PATCH] gOlogy: skip dbranch at -Og 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. for gcc/ChangeLog * opts.c (default_options_table): Do not enable OPT_fdelayed_branch at -Og. * doc/invoke.texi (-fdelayed-branch): Document it. From-SVN: r265708 --- gcc/ChangeLog | 6 ++++++ gcc/doc/invoke.texi | 3 ++- gcc/opts.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 56e802ef0af..234457a2584 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-10-31 Alexandre Oliva + + * opts.c (default_options_table): Do not enable + OPT_fdelayed_branch at -Og. + * doc/invoke.texi (-fdelayed-branch): Document it. + 2018-10-31 Richard Henderson * optabs-libfuncs.c (build_libfunc_function_visibility): diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 284594df010..e290128f535 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -8595,7 +8595,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 3b61e17a7ab..34c283dd765 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 }, -- 2.30.2