diff mbox series

[v2,1/3] Disable -fbit-tests and -fjump-tables at -O0

Message ID 20241028205719.685557-1-ak@linux.intel.com
State New
Headers show
Series [v2,1/3] Disable -fbit-tests and -fjump-tables at -O0 | expand

Commit Message

Andi Kleen Oct. 28, 2024, 8:57 p.m. UTC
From: Andi Kleen <ak@gcc.gnu.org>

gcc/ChangeLog:

	* common.opt: Enable -fbit-tests and -fjump-tables only at -O1.
	* opts.cc (default_options_table): Dito.
---
 gcc/common.opt | 4 ++--
 gcc/opts.cc    | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Richard Biener Oct. 29, 2024, 9:23 a.m. UTC | #1
On Mon, Oct 28, 2024 at 9:58 PM Andi Kleen <ak@linux.intel.com> wrote:
>
> From: Andi Kleen <ak@gcc.gnu.org>
>
> gcc/ChangeLog:

OK.

Thanks,
Richard.

>         * common.opt: Enable -fbit-tests and -fjump-tables only at -O1.
>         * opts.cc (default_options_table): Dito.
> ---
>  gcc/common.opt | 4 ++--
>  gcc/opts.cc    | 2 ++
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/gcc/common.opt b/gcc/common.opt
> index 12b25ff486de..70a22cdc71a4 100644
> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -2189,11 +2189,11 @@ Common Var(flag_ivopts) Init(1) Optimization
>  Optimize induction variables on trees.
>
>  fjump-tables
> -Common Var(flag_jump_tables) Init(1) Optimization
> +Common Var(flag_jump_tables) Init(0) Optimization
>  Use jump tables for sufficiently large switch statements.
>
>  fbit-tests
> -Common Var(flag_bit_tests) Init(1) Optimization
> +Common Var(flag_bit_tests) Init(0) Optimization
>  Use bit tests for sufficiently large switch statements.
>
>  fkeep-inline-functions
> diff --git a/gcc/opts.cc b/gcc/opts.cc
> index acd53befdbfc..7adc495a7c2a 100644
> --- a/gcc/opts.cc
> +++ b/gcc/opts.cc
> @@ -610,6 +610,7 @@ static const struct default_options default_options_table[] =
>      { OPT_LEVELS_1_PLUS, OPT_fvar_tracking, NULL, 1 },
>
>      /* -O1 (and not -Og) optimizations.  */
> +    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fbit_tests, NULL, 1 },
>      { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fbranch_count_reg, NULL, 1 },
>  #if DELAY_SLOTS
>      { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fdelayed_branch, NULL, 1 },
> @@ -618,6 +619,7 @@ static const struct default_options default_options_table[] =
>      { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fif_conversion, NULL, 1 },
>      { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fif_conversion2, NULL, 1 },
>      { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_finline_functions_called_once, NULL, 1 },
> +    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fjump_tables, NULL, 1 },
>      { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fmove_loop_invariants, NULL, 1 },
>      { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fmove_loop_stores, NULL, 1 },
>      { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fssa_phiopt, NULL, 1 },
> --
> 2.46.2
>
diff mbox series

Patch

diff --git a/gcc/common.opt b/gcc/common.opt
index 12b25ff486de..70a22cdc71a4 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2189,11 +2189,11 @@  Common Var(flag_ivopts) Init(1) Optimization
 Optimize induction variables on trees.
 
 fjump-tables
-Common Var(flag_jump_tables) Init(1) Optimization
+Common Var(flag_jump_tables) Init(0) Optimization
 Use jump tables for sufficiently large switch statements.
 
 fbit-tests
-Common Var(flag_bit_tests) Init(1) Optimization
+Common Var(flag_bit_tests) Init(0) Optimization
 Use bit tests for sufficiently large switch statements.
 
 fkeep-inline-functions
diff --git a/gcc/opts.cc b/gcc/opts.cc
index acd53befdbfc..7adc495a7c2a 100644
--- a/gcc/opts.cc
+++ b/gcc/opts.cc
@@ -610,6 +610,7 @@  static const struct default_options default_options_table[] =
     { OPT_LEVELS_1_PLUS, OPT_fvar_tracking, NULL, 1 },
 
     /* -O1 (and not -Og) optimizations.  */
+    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fbit_tests, NULL, 1 },
     { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fbranch_count_reg, NULL, 1 },
 #if DELAY_SLOTS
     { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fdelayed_branch, NULL, 1 },
@@ -618,6 +619,7 @@  static const struct default_options default_options_table[] =
     { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fif_conversion, NULL, 1 },
     { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fif_conversion2, NULL, 1 },
     { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_finline_functions_called_once, NULL, 1 },
+    { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fjump_tables, NULL, 1 },
     { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fmove_loop_invariants, NULL, 1 },
     { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fmove_loop_stores, NULL, 1 },
     { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_fssa_phiopt, NULL, 1 },