]> git.ipfire.org Git - thirdparty/gcc.git/commit
asf: Fix case of multiple stores with base offset [PR120660]
authorKonstantinos Eleftheriou <konstantinos.eleftheriou@vrull.eu>
Fri, 18 Jul 2025 11:46:41 +0000 (04:46 -0700)
committerPhilipp Tomsich <philipp.tomsich@vrull.eu>
Tue, 29 Jul 2025 14:27:16 +0000 (16:27 +0200)
commitfa1919d3216d2a57cb086ca2e6fcdb8548de04c2
treec93ddb4358806a3a7b88e7b790862fc7ab739638
parent689ee39f7bbb632a9ca7d1dc18192bd1921e54a8
asf: Fix case of multiple stores with base offset [PR120660]

When having multiple stores with the same offset as the load, in the
case that we are eliminating the load, we were generating a mov instruction
for both of them, leading to the overwrite of the register containing the
loaded value.

This patch fixes this issue by generating a mov instruction only for the
first store in the store-load sequence that has the same offset as the load.
For the next ones that might be encountered, we use bit-field insertion.

Bootstrapped/regtested on AArch64 and x86_64.

PR rtl-optimization/120660

gcc/ChangeLog:

* avoid-store-forwarding.cc (process_store_forwarding):
Fix instruction generation when haveing multiple stores with
base offset.

gcc/testsuite/ChangeLog:

* gcc.dg/pr120660.c: New test.
gcc/avoid-store-forwarding.cc
gcc/testsuite/gcc.dg/pr120660.c [new file with mode: 0644]