]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Avoid allocating FPRs to address registers [PR113623]
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 30 Jan 2024 09:30:35 +0000 (09:30 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 30 Jan 2024 09:30:35 +0000 (09:30 +0000)
commitfa2739ac1b74769d97fba34db9b9a8aa8786539e
tree331421137f262e3c46904e3d5f465e59395ec663
parentaeec7d87a28ac80c64ebfa88cef3dccee3ba8efc
aarch64: Avoid allocating FPRs to address registers [PR113623]

For something like:

void
foo (void)
{
  int *ptr;
  asm volatile ("%0" : "=w" (ptr));
  asm volatile ("%0" :: "m" (*ptr));
}

early-ra would allocate ptr to an FPR for the first asm, thus
leaving an FPR address in the second asm.  The address was then
reloaded by LRA to make it valid.

But early-ra shouldn't be allocating at all in that kind of
situation.  Doing so caused the ICE in the PR (with LDP fusion).

Fixed by making sure that we record address references as
GPR references.

gcc/
PR target/113623
* config/aarch64/aarch64-early-ra.cc (early_ra::preprocess_insns):
Mark all registers that occur in addresses as needing a GPR.

gcc/testsuite/
PR target/113623
* gcc.c-torture/compile/pr113623.c: New test.
gcc/config/aarch64/aarch64-early-ra.cc
gcc/testsuite/gcc.c-torture/compile/pr113623.c [new file with mode: 0644]