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

--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <l...@gcc.gnu.org>:

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

commit r14-1738-gae193f9008e02683e27f3c87f3b06f38e103b1d0
Author: Jeff Law <j...@ventanamicro.com>
Date:   Mon Jun 12 12:52:10 2023 -0600

    [committed] [PR rtl-optimization/101188] Fix reload_cse_move2add ignoring
clobbers

    So as Georg-Johann discusses in the BZ, reload_cse_move2add can generate
     incorrect code when optimizing code with clobbers.  Specifically in the
    case where we try to optimize a sequence of 4 operations down to 3
    operations we can reset INSN to the next instruction and continue the loop.

    That skips the code to invalidate objects based on things like REG_INC
    nodes, stack pushes and most importantly clobbers attached to the current
    insn.

    This patch factors all of the invalidation code used by reload_cse_move2add
    into a new function and calls it at the appropriate time.

    Georg-Johann has confirmed this patch fixes his avr bug and I've had it in
    my tester over the weekend.  It's bootstrapped and regression tested on
    aarch64, m68k, sh4, alpha and hppa.  It's also regression tested
successfully
    on a wide variety of other targets.

    gcc/
            PR rtl-optimization/101188
            * postreload.cc (reload_cse_move2add_invalidate): New function,
            extracted from...
            (reload_cse_move2add): Call reload_cse_move2add_invalidate.

    gcc/testsuite
            PR rtl-optimization/101188
            * gcc.c-torture/execute/pr101188.c: New test

Reply via email to