]> git.ipfire.org Git - thirdparty/gcc.git/commit
aarch64: Tighten early-ra chain test for wide registers [PR113295]
authorRichard Sandiford <richard.sandiford@arm.com>
Fri, 23 Feb 2024 14:12:55 +0000 (14:12 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Fri, 23 Feb 2024 14:12:55 +0000 (14:12 +0000)
commit9f105cfdc1bca6c9224384b3044c4ca5894e1e4c
tree91355f6fe32e8cc43c07040cda7f7fc98dccecfa
parent8a16e06da97f51574cfad17e2cece2e58571305d
aarch64: Tighten early-ra chain test for wide registers [PR113295]

Most code in early-ra used is_chain_candidate to check whether we
should chain two allocnos.  This included both tests that matter
for correctness and tests for certain heuristics.

Once that test passes for one pair of allocnos, we test whether
it's safe to chain the containing groups (which might contain
multiple allocnos for x2, x3 and x4 modes).  This test used an
inline test for correctness only, deliberately skipping the
heuristics.  However, this instance of the test was missing
some handling of equivalent allocnos.

This patch fixes things by making is_chain_candidate take a
strictness parameter: correctness only, or correctness + heuristics.
It then makes the group-chaining test use the correctness version
rather than trying to replicate it inline.

gcc/
PR target/113295
* config/aarch64/aarch64-early-ra.cc
(early_ra::test_strictness): New enum.
(early_ra::is_chain_candidate): Add a strictness parameter to
control whether only correctness matters, or whether both correctness
and heuristics should be used.  Handle multiple levels of equivalence.
(early_ra::find_related_start): Update call accordingly.
(early_ra::strided_polarity_pref): Likewise.
(early_ra::form_chains): Likewise.
(early_ra::try_to_chain_allocnos): Use is_chain_candidate in
correctness mode rather than trying to inline the test.

gcc/testsuite/
PR target/113295
* gcc.target/aarch64/pr113295-2.c: New test.
gcc/config/aarch64/aarch64-early-ra.cc
gcc/testsuite/gcc.target/aarch64/pr113295-2.c [new file with mode: 0644]