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

--- Comment #4 from GCC 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:d23d338da4d2bd581b2d3fd97785dd2c26053a92

commit r15-6867-gd23d338da4d2bd581b2d3fd97785dd2c26053a92
Author: Jeff Law <j...@ventanamicro.com>
Date:   Mon Jan 13 07:29:39 2025 -0700

    [PR rtl-optimization/107455] Eliminate unnecessary constant load

    This resurrects a patch from a bit over 2 years ago that I never wrapped
up.
    IIRC, I ended up up catching covid, then in the hospital for an unrelated
issue
    and it just got dropped on the floor in the insanity.

    The basic idea here is to help postreload-cse eliminate more const/copies
by
    recording a small set of conditional equivalences (as Richi said in 2022,
    "Ick").

    It was originally to help eliminate an unnecessary constant load I saw in
    coremark, but as seen in BZ107455 the same issues show up in real code as
well.

    Bootstrapped and regression tested on x86-64, also been through multiple
spins
    in my tester.

    Changes since v2:

      - Simplified logic for blocks to examine
      - Remove redundant tests when filtering blocks to examine
      - Remove bogus check which only allowed reg->reg copies

    Changes since v1:

    Richard B and Richard S both had good comments last time around and their
    requests are reflected in this update:

      - Use rtx_equal_p rather than pointer equality
      - Restrict to register "destinations"
      - Restrict to integer modes
      - Adjust entry block handling

    My own wider scale testing resulted in a few more changes.

      - Robustify extracting the (set (pc) ... ), which then required ...
      - Handle if src/dst are clobbered by the conditional branch
      - Fix logic error causing too many equivalences to be recorded

            PR rtl-optimization/107455
    gcc/
            * postreload.cc (reload_cse_regs_1): Take advantage of conditional
            equivalences.

    gcc/testsuite
            * gcc.target/riscv/pr107455-1.c: New test.
            * gcc.target/riscv/pr107455-2.c: New test.

Reply via email to