]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Detect word-level modification in early-ra [PR118184]
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 2 Jan 2025 11:34:52 +0000 (11:34 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 2 Jan 2025 11:34:52 +0000 (11:34 +0000)
commit2b687ad95de61091105d040d6bc06cb3d44ac3d1
tree09782eb347217a38f13e8ae226d6e70f8de47d7d
parentcb403df46fc9275530669925faac5c256fdd2596
aarch64: Detect word-level modification in early-ra [PR118184]

REGMODE_NATURAL_SIZE is set to 64 bits for everything except
VLA SVE modes.  This means that it's possible to modify (say)
the highpart of a TI pseudo or a V2DI pseudo independently
of the lowpart.  Modifying such highparts requires a reload
if the highpart ends up in the upper 64 bits of an FPR,
since RTL semantics do not allow the highpart of a single
hard register to be modified independently of the lowpart.

early-ra missed a check for this case, which meant that it
effectively treated an assignment to (subreg:DI (reg:TI R) 0)
as an assignment to the whole of R.

gcc/
PR target/118184
* config/aarch64/aarch64-early-ra.cc (allocno_assignment_is_rmw):
New function.
(early_ra::record_insn_defs): Mark the live range information as
untrustworthy if an assignment would change part of an allocno
but preserve the rest.

gcc/testsuite/
* gcc.dg/torture/pr118184.c: New test.
gcc/config/aarch64/aarch64-early-ra.cc
gcc/testsuite/gcc.dg/torture/pr118184.c [new file with mode: 0644]