]> git.ipfire.org Git - thirdparty/gcc.git/commit
Alpha: Fix base block alignment calculation regression
authorMaciej W. Rozycki <macro@orcam.me.uk>
Fri, 16 May 2025 16:18:53 +0000 (17:18 +0100)
committerMaciej W. Rozycki <macro@orcam.me.uk>
Fri, 16 May 2025 16:18:53 +0000 (17:18 +0100)
commite968c7311c628f36871b0e0d9cf7f42b5a8956ac
treebf74f81f2b7a92c2fed9ee81faeff07a5b083b54
parenta87bd3cca4e990c9151a3f713f68a07bff650b8f
Alpha: Fix base block alignment calculation regression

In determination of base block alignment we only examine a COMPONENT_REF
tree node at hand without ever checking if its ultimate alignment has
been reduced by the combined offset going back to the outermost object.
Consequently cases have been observed where quadword accesses have been
produced for a memory location referring a nested struct member only
aligned to the longword boundary, causing emulation to trigger.

Address this issue by recursing into COMPONENT_REF tree nodes until the
outermost one has been reached, which is supposed to be a MEM_REF one,
accumulating the offset as we go, fixing a commit e0dae4da4c45 ("Alpha:
Also use tree information to get base block alignment") regression.

Bail out and refrain from using tree information for alignment if we end
up at something different or we are unable to calculate the offset at
any point.

gcc/
* config/alpha/alpha.cc
(alpha_get_mem_rtx_alignment_and_offset): Recurse into
COMPONENT_REF nodes.

gcc/testsuite/
* gcc.target/alpha/memcpy-nested-offset-long.c: New file.
* gcc.target/alpha/memcpy-nested-offset-quad.c: New file.

(cherry picked from commit 1dd769b3d0d9251649dcb645d7ed6c4ba2202306)
gcc/config/alpha/alpha.cc
gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-long.c [new file with mode: 0644]
gcc/testsuite/gcc.target/alpha/memcpy-nested-offset-quad.c [new file with mode: 0644]