On 10/28/26 3:12 AM, e0001533 wrote:
From: panciyan <[email protected]>

When a constant-size block copy has a size that is an exact multiple
of the word size and a copied word is immediately overwritten by a
later store, the pre-patch expansion defers the trailing whole word
to move_by_pieces, emitting its accesses after the group's stores.
RTL DSE then cannot prove that the trailing load does not read the
overwritten word, so it retains the dead copy pair, costing one dead
load and one dead store per overwritten word.

Keeping the trailing whole word in the group keeps all loads ahead of
all stores, which lets DSE remove the dead pair.  The new
cpymem-dse-1.c test (a copy whose Int_Comp word is immediately
overwritten; 48 bytes on rv32, 64 on rv64) flips from FAIL to PASS.

Signed-off-by: Ciyan Pan <[email protected]>
gcc/ChangeLog:

         * config/riscv/riscv-string.cc (riscv_block_move_straight):

gcc/testsuite/ChangeLog:

         * gcc.target/riscv/cpymem-dse-1.c: New test.
You didn't indicate if you'd run the full testsuite or not, so I went ahead and threw it into my tester to ensure the basic tests were run.  In the future you need to verify there are no regressions using "make check" before and after your patch and comparing the summary files.  You also didn't include a ChangeLog entry for the riscv-string change.  I fixed that for you.

Other than the testing & ChangeLog goof's I didn't see anything concerning.  Sashiko raised no concerns either.  I've pushed this to the trunk.

jeff

Reply via email to