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

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

https://gcc.gnu.org/g:0eea1e39af146d98d8bce3d93ede34ea13196899

commit r17-4467-g0eea1e39af146d98d8bce3d93ede34ea13196899
Author: Yongqiang Tian <[email protected]>
Date:   Fri Sep 18 23:03:54 2026 +1000

    pru: Ignore debug insns when padding repeat loops [PR127460]

    pru_insert_loop_label_last walks backward over the final two opcodes of a
    repeat loop to determine how much padding to add.  INSN_P also accepts
    debug instructions, so a surviving DEBUG_INSN can be treated as an
    unrecognized opcode and stop the walk early.  This causes the function to
    add an extra NOP.

    Use NONDEBUG_INSN_P so debug instructions do not affect the opcode count.
    Add a regression test for the extra padding observed with
    -g -fno-var-tracking.

    Tested for pru-unknown-elf.  The new test fails before the fix and passes
    after it.  The complete PRU testsuite has no new failures.  Also
    bootstrapped and regression-tested on x86_64-pc-linux-gnu with no new
    failures.

    gcc/ChangeLog:

            PR target/127460

            * config/pru/pru.cc (pru_insert_loop_label_last): Ignore debug
            instructions while counting final loop opcodes.

    gcc/testsuite/ChangeLog:

            PR target/127460

            * gcc.target/pru/pr127460.c: New test.

    Signed-off-by: Yongqiang Tian <[email protected]>

Reply via email to