===================================================================
@@ -0,0 +1,1 @@
+BOOT_CFLAGS := -O1g $(filter-out -O%, $(BOOT_CFLAGS))
===================================================================
@@ -487,6 +487,9 @@ Og
Common Optimization
Optimize for debugging experience rather than speed or size.
+O1g
+Common Optimization
+
Q
Driver
===================================================================
@@ -8403,6 +8403,19 @@ optimization flags except for those that
-fmove-loop-invariants -fssa-phiopt @gol
-ftree-bit-ccp -ftree-pta -ftree-sra}
+@item -O1g
+@opindex O1g
+Perform the same optimizations as @option{-O1}, but take the debug
+experience into consideration when optimizing. In particular, try to
+make sure that the values of simple variables are printable at any
+point during their scope.
+
+This option is a compromise between @option{-Og} and @option{-O1}.
+The code it produces is generally faster than the code that
+@option{-Og} produces, but not as fast as the code that @option{-O1}
+produces. In contrast, the code that @option{-O1g} produces should be
+easier to debug than code that @option{-O1} produces, but might not be
+as easy to debug as the code that @option{-Og} produces.
@end table
If you use multiple @option{-O} options, with or without level numbers,
===================================================================
@@ -639,6 +639,14 @@ default_options_optimization (struct gcc
opts->x_flag_tangible_debug = 1;
break;
+ case OPT_O1g:
+ opts->x_optimize_size = 0;
+ opts->x_optimize = 1;
+ opts->x_optimize_fast = 0;
+ opts->x_optimize_debug = 0;
+ opts->x_flag_tangible_debug = 1;
+ break;
+
case OPT_fopenacc:
if (opt->value)
openacc_mode = true;
@@ -2323,6 +2331,7 @@ common_handle_option (struct gcc_options
case OPT_Os:
case OPT_Ofast:
case OPT_Og:
+ case OPT_O1g:
/* Currently handled in a prescan. */
break;
===================================================================
@@ -78,9 +78,9 @@ if {[check_guality "
gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.C]] "" ""
gcc-dg-runtest $general "" ""
set-torture-options \
- [list "-O0" "-Og"] \
+ [list "-O0" "-Og" "-O1g"] \
[list {}] \
- [list "-Og -flto"]
+ [list "-Og -flto" "-O1g -flto"]
gcc-dg-runtest $Og "" ""
}
===================================================================
@@ -93,9 +93,9 @@ if {[check_guality "
gcc-dg-runtest [lsort [glob $srcdir/$subdir/*.c]] "" ""
gcc-dg-runtest $general "" "-Wc++-compat"
set-torture-options \
- [list "-O0" "-Og"] \
+ [list "-O0" "-Og" "-O1g"] \
[list {}] \
- [list "-Og -flto"]
+ [list "-Og -flto" "-O1g -flto"]
gcc-dg-runtest $Og "" "-Wc++-compat"
}
===================================================================
@@ -32,7 +32,8 @@ set SSO_TORTURE_OPTIONS [list \
{ -O2 } \
{ -O3 -finline-functions } \
{ -Os } \
- { -Og -g } ]
+ { -Og -g } \
+ { -O1g -g } ]
set-torture-options $SSO_TORTURE_OPTIONS
===================================================================
@@ -28,7 +28,8 @@ set SSO_TORTURE_OPTIONS [list \
{ -O2 } \
{ -O3 -finline-functions } \
{ -Os } \
- { -Og -g } ]
+ { -Og -g } \
+ { -O1g -g } ]
set-torture-options $SSO_TORTURE_OPTIONS
===================================================================
@@ -56,7 +56,8 @@ if [info exists TORTURE_OPTIONS] {
{ -O3 -fomit-frame-pointer -funroll-loops -fpeel-loops -ftracer -finline-functions } \
{ -O3 -g } \
{ -Os } \
- { -Og -g } ]
+ { -Og -g } \
+ { -O1g -g } ]
if [check_effective_target_lto] {
# When having plugin test both slim and fat LTO and plugin/nonplugin