[PATCH] Add -Og optimization level - optimize for compile-time/debugging experience

H.J. Lu hjl.tools@gmail.com
Tue Sep 18 12:08:00 GMT 2012


On Tue, Sep 18, 2012 at 4:23 AM, Richard Guenther <rguenther@suse.de> wrote:
>
> This adds -Og as optimization level targeted at the devel-compile-debug
> cycle (formerly mostly tied to -O0 due to debug issues with even -O1).
>
> Discussion on gcc@gcc.gnu.org at least shows interest in this, so this
> is a formal patch submission with a request for comments on the
> implementation (not necessarily on what passes are enabled and why).
>
> I have bootstrapped and tested this patch with BOOT_C/CXX_FLAGS="-Og -g"
> TARGET_CFLAGS="-Og -g" with all languages included (but -Werror disabled,
> as expected some new maybe-uninit uses pop up).
>
> Ok for trunk?
>
> Thanks,
> Richard.
>
> 2012-09-18  Richard Guenther  <rguenther@suse.de>
>
>         PR other/53316
>         * common.opt (optimize_debug): New variable.
>         (Og): New optimization level.
>         * doc/invoke.texi (Og): Document.
>         * opts.c (maybe_default_option): Add debug parameter.
>         (maybe_default_options): Likewise.
>         (default_options_optimization): Handle -Og.
>         (common_handle_option): Likewise.
>         * passes.c (gate_all_optimizations): Do not run with -Og.
>         (gate_all_optimizations_g): New gate, run with -Og.
>         (pass_all_optimizations_g): New container pass, run with -Og.
>         (init_optimization_passes): Schedule pass_all_optimizations_g
>         alongside pass_all_optimizations.
>
>         * gcc/testsuite/lib/c-torture.exp: Add -Og -g to default
>         TORTURE_OPTIONS.
>

Glibc must be compiled with optimization.  Will -Og build glibc?

-- 
H.J.



More information about the Gcc-patches mailing list