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

--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-15 branch has been updated by Georg-Johann Lay
<[email protected]>:

https://gcc.gnu.org/g:2479a3d1bfbc4ad5f7bbf22863f09594fc37f8db

commit r15-11500-g2479a3d1bfbc4ad5f7bbf22863f09594fc37f8db
Author: Georg-Johann Lay <[email protected]>
Date:   Sun Aug 23 20:52:57 2026 +0200

    AVR: target/127004 - Fix ICE "incomplete application of insn"

    This ICE occurs when RTL pass avr-fuse-move finds an optimization,
    and then finds a difference between the outcomes of the new insn
    sequence and the old one.

    In this specific case, optimize_data_t::ignore_mask didn't account
    for all the regs clobbered by the old sequence, so that the pass
    logic concluded there was a bug in the optimization and ICEd.

    The old insn is a SImode multiplication with a known result,
    which clobbers quite some regs because it is implemented as a
    transparent libgcc call.  The optimization replaces that
    multiplication with a constant.

    The ICE only occurs with -mpr118012 which tries to hack around
    PR118012 by calling the libgcc multiplications by hand instead
    of relying on the libcall machinery.

    The fix traverses the old pattern and gathers all scratch regs
    in ignore_mask.  The patch passes without new regressions.
    It fixes the ICE which occurred for targets that don't have MUL.

            PR target/127004
    gcc/
            * config/avr/avr-passes.cc (rtl-iter.h): Include.
            (insninfo_t::scratch_mask): New method.
            (optimize_data_t::try_split_ldi): Use it for ignore_mask.
            (optimize_data_t::try_split_any): Same.
            (optimize_data_t::emit_sequence): Dump ignore_mask prior to
            calling fatal_insn.
    gcc/testsuite/
            * gcc.target/avr/torture/pr127004.c: New test.

    (cherry picked from commit 91291a45490dae956752e55398b6562505692dc5)

Reply via email to