On 9/22/26 3:33 AM, [email protected] wrote:
From: Kyrylo Tkachov <[email protected]>

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.  A target without TARGET_ASM_JUMP_TABLE_BASE has unchanged generated
code.

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.

gcc/testsuite/ChangeLog:

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

Signed-off-by: Kyrylo Tkachov <[email protected]>
OK if and when prereqs are OK'd.
jeff

Reply via email to