https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126236

--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Kyrylo Tkachov <[email protected]>:

https://gcc.gnu.org/g:d9254f775ce7915885f4ff9e7ae3b75f4b2ceade

commit r17-5809-gd9254f775ce7915885f4ff9e7ae3b75f4b2ceade
Author: Kyrylo Tkachov <[email protected]>
Date:   Thu Oct 15 20:15:49 2026 +0200

    common: Enable -fduplicate-switch-dispatch at -O2 [PR middle-end/126236]

    The switch-dispatch transformation trades code size for dispatch speed.  At
    -O2 on an AArch64 Olympus system it improves mawk by 5.7% and QuickJS-ng by
    25.2%.  Their text changes are 3.73% and 0.90%, respectively.  At -Ofast it
    improves 714.cpython_r by 7.7% with a 0.20% text change.

    Enable the option at -O2 for speed builds, where the existing computed-goto
    unfactoring also runs.  Keep it disabled for -Os, -Oz, and size-optimized
    functions.  It applies to every target that does not refuse to share jump
    tables through TARGET_CAN_SHARE_JUMP_TABLE_P.

    gcc/ChangeLog:

            PR middle-end/126236
            * opts.cc (default_options_table): Enable
            -fduplicate-switch-dispatch at -O2 for speed builds.
            * doc/invoke.texi: Document it.  List it among the options that
            -Os does not enable.

    gcc/testsuite/ChangeLog:

            PR middle-end/126236
            * gcc.dg/switch-dispatch-5.c: New test.
            * gcc.target/aarch64/switch-dispatch-1.c: Test default enablement
at
            -O2.

    Signed-off-by: Kyrylo Tkachov <[email protected]>

Reply via email to