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

--- Comment #6 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:b2c1ee0989bb010143e8eb5d931ffc28bb1aca7c

commit r17-5802-gb2c1ee0989bb010143e8eb5d931ffc28bb1aca7c
Author: Kyrylo Tkachov <[email protected]>
Date:   Thu Oct 15 19:57:35 2026 +0200

    bb-reorder: Respect max-goto-duplication-insns without insn lengths [PR
middle-end/126236]

    pass_duplicate_computed_gotos measures blocks in units of the minimum
    length of an unconditional jump.  On a target without a length attribute,
    such as c6x, ft32, ia64, m68k, mmix, mn10300, rl78 or vax,
    get_attr_min_length returns 0.  The budget is then 0 and every block costs
    0, so the pass copies blocks of any size and ignores
    --param=max-goto-duplication-insns, even when it is 0.

    Count one unit per active insn on such targets, and assert that the unit
    is not 0.  Debug insns cost nothing, as before.  Targets with a length
    attribute are unchanged.  On the others the pass no longer emits a scratch
    jump to measure its length, so the numbers of later labels change.
    copy_bb_p and shrink-wrapping use the same lengths and are not changed
    here.

    Bootstrapped and tested on aarch64-linux-gnu and x86_64-linux-gnu with the
    rest of the series.  With cross compilers for c6x, ft32, ia64, m68k, mmix,
    mn10300, rl78 and vax, duplicate-computed-goto-1.c now gets no copies
    (21 before), and duplicate-computed-goto-2.c gets the same 21.

    gcc/ChangeLog:

            PR middle-end/126236
            * bb-reorder.cc: Include insn-attr.h.
            (duplication_unit): New function.
            (duplication_size): Likewise.
            (maybe_duplicate_computed_goto): Use duplication_size.
            (duplicate_computed_gotos): Use duplication_unit.

    gcc/testsuite/ChangeLog:

            PR middle-end/126236
            * gcc.dg/duplicate-computed-goto-1.c: New test.
            * gcc.dg/duplicate-computed-goto-2.c: New test.

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

Reply via email to